237 |
kaklik |
1 |
#include ".\infra.h" |
221 |
svejda |
2 |
|
242 |
svejda |
3 |
|
221 |
svejda |
4 |
#define MAX_SLOVO 10 // Maximalni pocet znaku ve slovu |
|
|
5 |
|
240 |
kaklik |
6 |
int8 napis[MAX_SLOVO+1]; |
237 |
kaklik |
7 |
int8 otacky; |
221 |
svejda |
8 |
|
242 |
svejda |
9 |
const int8 logo[MAX_SLOVO+1]={'[',96,94,94,'b',']',96,94,94,'f',0}; // 2004-2008 |
|
|
10 |
const int8 rok[MAX_SLOVO+1]={'[','[',92,'[','E','b','A','[',92,'[',0}; // [blesk] E4A [blesk] |
241 |
kaklik |
11 |
|
221 |
svejda |
12 |
#int_RDA |
240 |
kaklik |
13 |
void RDA_isr(void) |
221 |
svejda |
14 |
{ |
|
|
15 |
int n; |
|
|
16 |
output_B(0x55); |
240 |
kaklik |
17 |
for(n=0;n<MAX_SLOVO;n++) |
221 |
svejda |
18 |
{ |
240 |
kaklik |
19 |
napis[n]=getc(); |
221 |
svejda |
20 |
} |
|
|
21 |
} |
|
|
22 |
|
240 |
kaklik |
23 |
void LED_print() |
|
|
24 |
{ |
241 |
kaklik |
25 |
unsigned int slovo,pismeno,sloupec,j; |
242 |
svejda |
26 |
3 |
|
|
27 |
const int8 pis[38*5]={0b00000001,0b11110110,0b11110110,0b11110110,0b00000001, //A |
237 |
kaklik |
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 |
242 |
svejda |
53 |
0b11111111,0b11111111,0b11111111,0b11111111,0b11111111, //mezera [ 91 |
|
|
54 |
0b00010111,0b00110011,0b01010101,0b11100110,0b11110111, //blesk \ 92 |
|
|
55 |
0b11110111,0b11110111,0b11110111,0b11110111,0b11110111, //pomlka ] 93 |
|
|
56 |
0b00000000,0b01111110,0b01111110,0b01111110,0b00000000, //0 ^ 94 |
|
|
57 |
0b01111011,0b01111101,0b00000000,0b01111111,0b01111111, //1 _ 95 |
|
|
58 |
0b00111101,0b01011110,0b01101110,0b01110110,0b01111001, //2 ` 96 |
|
|
59 |
0b10111101,0b01111110,0b01110110,0b01110110,0b10001001, //3 a 97 |
|
|
60 |
0b11110000,0b11110111,0b11110111,0b00000001,0b11110111, //4 b 98 |
|
|
61 |
0b10111000,0b01110110,0b01110110,0b01110110,0b10001110, //5 c 99 |
|
|
62 |
0b10000001,0b01110110,0b01110110,0b01110110,0b10001101, //6 d 100 |
|
|
63 |
0b11111110,0b11111110,0b00001110,0b11110110,0b11111000, //7 e 101 |
|
|
64 |
0b10001001,0b01110110,0b01110110,0b01110110,0b10001001, //8 f 102 |
|
|
65 |
0b10111001,0b01110110,0b01110110,0b01110110,0b10000001, //9 g 103 |
237 |
kaklik |
66 |
}; |
242 |
svejda |
67 |
|
241 |
kaklik |
68 |
while(read_adc()<9); // Cekani na magnet |
|
|
69 |
delay_ms(10); |
240 |
kaklik |
70 |
|
241 |
kaklik |
71 |
for(pismeno=0;pismeno<MAX_SLOVO;pismeno++) |
|
|
72 |
{ |
|
|
73 |
for(sloupec=0;sloupec<5;sloupec++) |
|
|
74 |
{ |
|
|
75 |
output_B(pis[(napis[pismeno]-0x41)*5+sloupec]); |
|
|
76 |
delay_us(500); |
|
|
77 |
} |
|
|
78 |
output_B(0xFF); |
|
|
79 |
delay_us(500); |
|
|
80 |
} |
|
|
81 |
} |
|
|
82 |
|
|
|
83 |
void main() |
|
|
84 |
{ |
|
|
85 |
|
|
|
86 |
|
237 |
kaklik |
87 |
setup_adc_ports(AN0); |
|
|
88 |
setup_adc(ADC_CLOCK_INTERNAL); |
221 |
svejda |
89 |
setup_psp(PSP_DISABLED); |
|
|
90 |
setup_spi(SPI_SS_DISABLED); |
|
|
91 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
92 |
setup_wdt(WDT_2304MS); |
|
|
93 |
setup_timer_1(T1_DISABLED); |
|
|
94 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
95 |
setup_comparator(NC_NC_NC_NC); |
|
|
96 |
setup_vref(FALSE); |
|
|
97 |
|
|
|
98 |
enable_interrupts(INT_RDA); |
|
|
99 |
enable_interrupts(GLOBAL); |
|
|
100 |
|
237 |
kaklik |
101 |
set_adc_channel(0); // Prevodnik pro Hall |
|
|
102 |
output_B(0xFF); // Zhasneme |
221 |
svejda |
103 |
|
237 |
kaklik |
104 |
otacky=0; |
240 |
kaklik |
105 |
napis[0]=0; |
|
|
106 |
|
221 |
svejda |
107 |
while(TRUE) |
|
|
108 |
{ |
241 |
kaklik |
109 |
if (napis[0]!=0) |
240 |
kaklik |
110 |
{ |
241 |
kaklik |
111 |
LED_print(); |
240 |
kaklik |
112 |
} |
241 |
kaklik |
113 |
else |
221 |
svejda |
114 |
{ |
241 |
kaklik |
115 |
strcpy(napis,logo); |
221 |
svejda |
116 |
} |
240 |
kaklik |
117 |
} |
221 |
svejda |
118 |
} |