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