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