Rev Author Line No. Line
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  
245 kaklik 9 const int8 logo[MAX_SLOVO+1]={'[','[',92,'[','E','e','A','[',92,'[',0}; // [blesk] E4A [blesk]
10 const int8 rok[MAX_SLOVO+1]={'[','c','a','a','e',']','c','a','a','i',0}; // 2004-2008
240 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 }
245 kaklik 21 otacky=0;
221 svejda 22 }
23  
241 kaklik 24 void LED_print()
221 svejda 25 {
241 kaklik 26 unsigned int slovo,pismeno,sloupec,j;
245 kaklik 27  
28 const int8 pis[45*5]={0b00000001,0b11110110,0b11110110,0b11110110,0b00000001, // A
29 0b00000000,0b01110110,0b01110110,0b01110110,0b10001001, // B
30 0b10000001,0b01111110,0b01111110,0b01111110,0b10111101, // C
31 0b00000000,0b01111110,0b01111110,0b01111110,0b10000001, // D
32 0b00000000,0b01110110,0b01110110,0b01111110,0b01111110, // E
33 0b00000000,0b11110110,0b11110110,0b11111110,0b11111110, // F
34 0b10000001,0b01111110,0b01110110,0b01110110,0b10000101, // G
35 0b00000000,0b11110111,0b11110111,0b11110111,0b00000000, // H
36 0b01111110,0b01111110,0b00000000,0b01111110,0b01111110, // I
37 0b10111110,0b01111110,0b01111110,0b01111110,0b10000000, // J
38 0b00000000,0b11110111,0b11110111,0b11101011,0b00011100, // K
39 0b00000000,0b01111111,0b01111111,0b01111111,0b01111111, // L
40 0b00000000,0b11111110,0b11110000,0b11111110,0b00000000, // M
41 0b00000000,0b11101111,0b11011111,0b10111111,0b00000000, // N
42 0b10000001,0b01111110,0b01111110,0b01111110,0b10000001, // O
43 0b00000000,0b11110110,0b11110110,0b11110110,0b11111001, // P
44 0b10000001,0b01111110,0b01111110,0b01111110,0b00000001, // Q
45 0b00000000,0b11110110,0b11110110,0b11110110,0b00001001, // R
46 0b10111001,0b01110110,0b01110110,0b01110110,0b10001101, // S
47 0b11111110,0b11111110,0b00000000,0b11111110,0b11111110, // T
48 0b10000000,0b01111111,0b01111111,0b01111111,0b10000000, // U
49 0b11000000,0b10111111,0b01111111,0b10111111,0b11000000, // V
50 0b10000000,0b01111111,0b10000000,0b01111111,0b10000000, // W
51 0b00011100,0b11101011,0b11110111,0b11101011,0b00011100, // X
52 0b11111000,0b11110111,0b00000111,0b11110111,0b11111000, // Y
53 0b00011110,0b01101110,0b01110110,0b01111010,0b01111100, // Z
54 0b11111111,0b11111111,0b11111111,0b11111111,0b11111111, // mezera [ 91
55 0b00010111,0b00110011,0b01010101,0b11100110,0b11110111, // blesk \ 92
56 0b11110111,0b11110111,0b11110111,0b11110111,0b11110111, // - ] 93
57 0b11111111,0b11111111,0b01111111,0b11111111,0b11111111, // . ^ 94
58 0b11111100,0b11110000,0b01000000,0b11110000,0b11111100, // ! _ 95
59 0b11111101,0b11111110,0b01001110,0b11110110,0b11111001, // ? ` 96
60 0b00000000,0b01111110,0b01111110,0b01111110,0b00000000, // 0 a
61 0b01111011,0b01111101,0b00000000,0b01111111,0b01111111, // 1 b
62 0b00111101,0b01011110,0b01101110,0b01110110,0b01111001, // 2 c
63 0b10111101,0b01111110,0b01110110,0b01110110,0b10001001, // 3 d
64 0b11110000,0b11110111,0b11110111,0b00000001,0b11110111, // 4 e
65 0b10111000,0b01110110,0b01110110,0b01110110,0b10001110, // 5 f
66 0b10000001,0b01110110,0b01110110,0b01110110,0b10001101, // 6 g
67 0b11111110,0b11111110,0b00001110,0b11110110,0b11111000, // 7 h
68 0b10001001,0b01110110,0b01110110,0b01110110,0b10001001, // 8 i
69 0b10111001,0b01110110,0b01110110,0b01110110,0b10000001, // 9 j
70 0b11111111,0b01111110,0b10111101,0b11000011,0b11111111, // ) k
71 0b11111111,0b11000011,0b10111101,0b01111110,0b11111111, // ( l
72 0b11111111,0b11111111,0b11111111,0b11011011,0b11111111, // : m
237 kaklik 73 };
245 kaklik 74  
241 kaklik 75 while(read_adc()<9); // Cekani na magnet
245 kaklik 76 while(read_adc()>50); // Cekani na magnet
241 kaklik 77 delay_ms(10);
240 kaklik 78  
241 kaklik 79 for(pismeno=0;pismeno<MAX_SLOVO;pismeno++)
80 {
81 for(sloupec=0;sloupec<5;sloupec++)
82 {
83 output_B(pis[(napis[pismeno]-0x41)*5+sloupec]);
84 delay_us(500);
85 }
86 output_B(0xFF);
87 delay_us(500);
88 }
89 }
90  
91 void main()
92 {
93  
94  
237 kaklik 95 setup_adc_ports(AN0);
96 setup_adc(ADC_CLOCK_INTERNAL);
221 svejda 97 setup_psp(PSP_DISABLED);
98 setup_spi(SPI_SS_DISABLED);
99 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
100 setup_wdt(WDT_2304MS);
101 setup_timer_1(T1_DISABLED);
102 setup_timer_2(T2_DISABLED,0,1);
103 setup_comparator(NC_NC_NC_NC);
104 setup_vref(FALSE);
105  
106 enable_interrupts(INT_RDA);
107 enable_interrupts(GLOBAL);
108  
237 kaklik 109 set_adc_channel(0); // Prevodnik pro Hall
110 output_B(0xFF); // Zhasneme
221 svejda 111  
237 kaklik 112 otacky=0;
240 kaklik 113 napis[0]=0;
114  
221 svejda 115 while(TRUE)
116 {
245 kaklik 117 int1 vyber;
118  
119 otacky++;
120  
121 if (napis[0]!=0 && otacky <= 30)
240 kaklik 122 {
242 svejda 123 LED_print();
240 kaklik 124 }
241 kaklik 125 else
221 svejda 126 {
245 kaklik 127 if (vyber == 0) strcpy(napis,logo);
128 else strcpy(napis,rok);
129 vyber++;
221 svejda 130 }
240 kaklik 131 }
221 svejda 132 }