Line 1... |
Line 1... |
1 |
#include "C:\RS\Prog\infra\infra.h" |
1 |
#include ".\infra.h" |
2 |
|
2 |
|
3 |
#define MAX_SLOVO 10 // Maximalni pocet znaku ve slovu |
3 |
#define MAX_SLOVO 10 // Maximalni pocet znaku ve slovu |
4 |
|
4 |
|
5 |
int8 napis[2*MAX_SLOVO] ={'A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A'}; |
5 |
int8 napis[2*MAX_SLOVO] ={'[','[',92,'[','E',']','A','[',92,'[','[','^','_','_',']',96,'^','_','_','a'}; |
- |
|
6 |
int8 otacky; |
6 |
|
7 |
|
7 |
#int_RDA |
8 |
#int_RDA |
8 |
void RDA_isr(void) |
9 |
void RDA_isr(void) |
9 |
{ |
10 |
{ |
10 |
int n; |
11 |
int n; |
Line 20... |
Line 21... |
20 |
{ |
21 |
{ |
21 |
|
22 |
|
22 |
int slovo,pismeno,sloupec,j; |
23 |
int slovo,pismeno,sloupec,j; |
23 |
|
24 |
|
24 |
|
25 |
|
25 |
const int8 pis[26*5]={0b00000001,0b11110110,0b11110110,0b11110110,0b00000001, |
26 |
const int8 pis[33*5]={0b00000001,0b11110110,0b11110110,0b11110110,0b00000001, //A |
26 |
0b00000001,0b11110110,0b11110110,0b11110110,0b00000001, |
27 |
0b00000000,0b01110110,0b01110110,0b01110110,0b10001001, //B |
27 |
0b10000001,0b01111110,0b01111110,0b01111110,0b10111101, |
28 |
0b10000001,0b01111110,0b01111110,0b01111110,0b10111101, //C |
28 |
0b00000000,0b01111110,0b01111110,0b01111110,0b10000001, |
29 |
0b00000000,0b01111110,0b01111110,0b01111110,0b10000001, //D |
29 |
0b00000000,0b01110110,0b01110110,0b01111110,0b01111110, |
30 |
0b00000000,0b01110110,0b01110110,0b01111110,0b01111110, //E |
30 |
0b00000000,0b11110110,0b11110110,0b11111110,0b11111110, |
31 |
0b00000000,0b11110110,0b11110110,0b11111110,0b11111110, //F |
31 |
0b10000001,0b01111110,0b01110110,0b01110110,0b10000101, |
32 |
0b10000001,0b01111110,0b01110110,0b01110110,0b10000101, //G |
32 |
0b00000000,0b11110111,0b11110111,0b11110111,0b00000000, |
33 |
0b00000000,0b11110111,0b11110111,0b11110111,0b00000000, //H |
33 |
0b01111110,0b01111110,0b00000000,0b01111110,0b01111110, |
34 |
0b01111110,0b01111110,0b00000000,0b01111110,0b01111110, //I |
34 |
0b10111110,0b01111110,0b01111110,0b01111110,0b10000000, |
35 |
0b10111110,0b01111110,0b01111110,0b01111110,0b10000000, //J |
35 |
0b00000000,0b11110111,0b11110111,0b11101011,0b00011100, |
36 |
0b00000000,0b11110111,0b11110111,0b11101011,0b00011100, //K |
36 |
0b00000000,0b01111111,0b01111111,0b01111111,0b01111111, |
37 |
0b00000000,0b01111111,0b01111111,0b01111111,0b01111111, //L |
37 |
0b00000000,0b11111110,0b11110000,0b11111110,0b00000000, |
38 |
0b00000000,0b11111110,0b11110000,0b11111110,0b00000000, //M |
38 |
0b00000000,0b11101111,0b11011111,0b10111111,0b00000000, |
39 |
0b00000000,0b11101111,0b11011111,0b10111111,0b00000000, //N |
39 |
0b10000001,0b01111110,0b01111110,0b01111110,0b10000001, |
40 |
0b10000001,0b01111110,0b01111110,0b01111110,0b10000001, //O |
40 |
0b00000000,0b11110110,0b11110110,0b11110110,0b11111001, |
41 |
0b00000000,0b11110110,0b11110110,0b11110110,0b11111001, //P |
41 |
0b10000001,0b01111110,0b01111110,0b01111110,0b00000001, |
42 |
0b10000001,0b01111110,0b01111110,0b01111110,0b00000001, //Q |
42 |
0b00000000,0b11110110,0b11110110,0b11110110,0b00001001, |
43 |
0b00000000,0b11110110,0b11110110,0b11110110,0b00001001, //R |
43 |
0b10111001,0b01110110,0b01110110,0b01110110,0b10001101, |
44 |
0b10111001,0b01110110,0b01110110,0b01110110,0b10001101, //S |
44 |
0b11111110,0b11111110,0b00000000,0b11111110,0b11111110, |
45 |
0b11111110,0b11111110,0b00000000,0b11111110,0b11111110, //T |
45 |
0b10000000,0b01111111,0b01111111,0b01111111,0b10000000, |
46 |
0b10000000,0b01111111,0b01111111,0b01111111,0b10000000, //U |
46 |
0b11000000,0b10111111,0b01111111,0b10111111,0b11000000, |
47 |
0b11000000,0b10111111,0b01111111,0b10111111,0b11000000, //V |
47 |
0b10000000,0b01111111,0b10000000,0b01111111,0b10000000, |
48 |
0b10000000,0b01111111,0b10000000,0b01111111,0b10000000, //W |
48 |
0b00011100,0b11101011,0b11110111,0b11101011,0b00011100, |
49 |
0b00011100,0b11101011,0b11110111,0b11101011,0b00011100, //X |
49 |
0b11111000,0b11110111,0b00000111,0b11110111,0b11111000, |
50 |
0b11111000,0b11110111,0b00000111,0b11110111,0b11111000, //Y |
50 |
0b00011110,0b01101110,0b01110110,0b01111010,0b01111100}; |
51 |
0b00011110,0b01101110,0b01110110,0b01111010,0b01111100, //Z |
- |
|
52 |
0b11111111,0b11111111,0b11111111,0b11111111,0b11111111, //mezera |
- |
|
53 |
0b00010111,0b00110011,0b01010101,0b11100110,0b11110111, //blesk |
- |
|
54 |
0b11110000,0b11110111,0b11110111,0b00000001,0b11110111, //4 |
- |
|
55 |
0b00111101,0b01011110,0b01101110,0b01110110,0b01111001, //2 |
- |
|
56 |
0b00000000,0b01111110,0b01111110,0b01111110,0b00000000, //0 |
- |
|
57 |
0b11110111,0b11110111,0b11110111,0b11110111,0b11110111, //pomlka |
- |
|
58 |
0b10001001,0b01110110,0b01110110,0b01110110,0b10001001, //8 |
- |
|
59 |
}; |
51 |
|
60 |
|
52 |
setup_adc_ports(NO_ANALOGS); |
61 |
setup_adc_ports(AN0); |
53 |
setup_adc(ADC_OFF); |
62 |
setup_adc(ADC_CLOCK_INTERNAL); |
54 |
setup_psp(PSP_DISABLED); |
63 |
setup_psp(PSP_DISABLED); |
55 |
setup_spi(SPI_SS_DISABLED); |
64 |
setup_spi(SPI_SS_DISABLED); |
56 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
65 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
57 |
setup_wdt(WDT_2304MS); |
66 |
setup_wdt(WDT_2304MS); |
58 |
setup_timer_1(T1_DISABLED); |
67 |
setup_timer_1(T1_DISABLED); |
Line 61... |
Line 70... |
61 |
setup_vref(FALSE); |
70 |
setup_vref(FALSE); |
62 |
|
71 |
|
63 |
enable_interrupts(INT_RDA); |
72 |
enable_interrupts(INT_RDA); |
64 |
enable_interrupts(GLOBAL); |
73 |
enable_interrupts(GLOBAL); |
65 |
|
74 |
|
66 |
set_adc_channel(0); |
75 |
set_adc_channel(0); // Prevodnik pro Hall |
- |
|
76 |
output_B(0xFF); // Zhasneme |
67 |
|
77 |
|
- |
|
78 |
otacky=0; |
- |
|
79 |
|
68 |
while(TRUE) |
80 |
while(TRUE) |
69 |
{ |
81 |
{ |
70 |
for(slovo=0;slovo<2;slovo++) |
82 |
for(slovo=0;slovo<2;slovo++) |
71 |
for(j=0;j<=100;j++) // Jedno slovo se zobrazi stokrat |
83 |
for(j=0;j<=20;j++) // Jedno slovo se zobrazi stokrat |
72 |
{ |
84 |
{ |
73 |
while(read_adc()<10); // Cekani na magnet |
85 |
while(read_adc()<9); // Cekani na magnet |
- |
|
86 |
delay_ms(10); |
74 |
|
87 |
|
75 |
for(pismeno=0;pismeno<MAX_SLOVO;pismeno++) |
88 |
for(pismeno=0;pismeno<MAX_SLOVO;pismeno++) |
76 |
{ |
89 |
{ |
77 |
for(sloupec=0;sloupec<5;sloupec++) |
90 |
for(sloupec=0;sloupec<5;sloupec++) |
78 |
{ |
91 |
{ |
79 |
// output_B(pis[(napis[slovo*MAX_SLOVO+pismeno]-0x40)*5+sloupec]); |
92 |
output_B(pis[(napis[slovo*MAX_SLOVO+pismeno]-0x41)*5+sloupec]); |
80 |
output_B(pis[1*5+sloupec]); |
- |
|
81 |
delay_ms(1); |
93 |
delay_us(500); |
82 |
} |
94 |
} |
- |
|
95 |
output_B(0xFF); |
83 |
delay_ms(2); |
96 |
delay_us(500); |
84 |
} |
97 |
} |
- |
|
98 |
if (otacky++>120) reset_cpu(); |
85 |
} |
99 |
} |
86 |
} |
100 |
} |
87 |
} |
101 |
} |