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  
244 svejda 9 const int8 logo[MAX_SLOVO+1]={'[','c','a','a','e',']','c','a','a','i',0}; // 2004-2008
10 const int8 rok[MAX_SLOVO+1]={'[','[',92,'[','E','e','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
244 svejda 27 const int8 pis[45*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 [ 91
54 0b00010111,0b00110011,0b01010101,0b11100110,0b11110111, // blesk \ 92
55 0b11110111,0b11110111,0b11110111,0b11110111,0b11110111, // - ] 93
56 0b11111111,0b11111111,0b01111111,0b11111111,0b11111111, // . ^ 94
57 0b11111100,0b11110000,0b01000000,0b11110000,0b11111100, // ! _ 95
58 0b11111101,0b11111110,0b01001110,0b11110110,0b11111001, // ? ` 96
59 0b00000000,0b01111110,0b01111110,0b01111110,0b00000000, // 0 a
60 0b01111011,0b01111101,0b00000000,0b01111111,0b01111111, // 1 b
61 0b00111101,0b01011110,0b01101110,0b01110110,0b01111001, // 2 c
62 0b10111101,0b01111110,0b01110110,0b01110110,0b10001001, // 3 d
63 0b11110000,0b11110111,0b11110111,0b00000001,0b11110111, // 4 e
64 0b10111000,0b01110110,0b01110110,0b01110110,0b10001110, // 5 f
65 0b10000001,0b01110110,0b01110110,0b01110110,0b10001101, // 6 g
66 0b11111110,0b11111110,0b00001110,0b11110110,0b11111000, // 7 h
67 0b10001001,0b01110110,0b01110110,0b01110110,0b10001001, // 8 i
68 0b10111001,0b01110110,0b01110110,0b01110110,0b10000001, // 9 j
69 0b11111111,0b01111110,0b10111101,0b11000011,0b11111111, // ) k
70 0b11111111,0b11000011,0b10111101,0b01111110,0b11111111, // ( l
71 0b11111111,0b11111111,0b11111111,0b11011011,0b11111111, // : m
237 kaklik 72 };
242 svejda 73  
241 kaklik 74 while(read_adc()<9); // Cekani na magnet
75 delay_ms(10);
240 kaklik 76  
241 kaklik 77 for(pismeno=0;pismeno<MAX_SLOVO;pismeno++)
78 {
79 for(sloupec=0;sloupec<5;sloupec++)
80 {
81 output_B(pis[(napis[pismeno]-0x41)*5+sloupec]);
82 delay_us(500);
83 }
84 output_B(0xFF);
85 delay_us(500);
86 }
87 }
88  
89 void main()
90 {
91  
92  
237 kaklik 93 setup_adc_ports(AN0);
94 setup_adc(ADC_CLOCK_INTERNAL);
221 svejda 95 setup_psp(PSP_DISABLED);
96 setup_spi(SPI_SS_DISABLED);
97 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
98 setup_wdt(WDT_2304MS);
99 setup_timer_1(T1_DISABLED);
100 setup_timer_2(T2_DISABLED,0,1);
101 setup_comparator(NC_NC_NC_NC);
102 setup_vref(FALSE);
103  
104 enable_interrupts(INT_RDA);
105 enable_interrupts(GLOBAL);
106  
237 kaklik 107 set_adc_channel(0); // Prevodnik pro Hall
108 output_B(0xFF); // Zhasneme
221 svejda 109  
237 kaklik 110 otacky=0;
240 kaklik 111 napis[0]=0;
112  
221 svejda 113 while(TRUE)
114 {
241 kaklik 115 if (napis[0]!=0)
240 kaklik 116 {
241 kaklik 117 LED_print();
240 kaklik 118 }
241 kaklik 119 else
221 svejda 120 {
241 kaklik 121 strcpy(napis,logo);
221 svejda 122 }
240 kaklik 123 }
221 svejda 124 }