182 |
svejda |
1 |
#include "abcda.h" |
181 |
svejda |
2 |
|
218 |
kaklik |
3 |
#define MAX_SLOVO 10 // Maximalni pocet znaku ve slovu |
181 |
svejda |
4 |
|
218 |
kaklik |
5 |
int8 napis[2*MAX_SLOVO] ={'A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A','A'}; |
|
|
6 |
|
|
|
7 |
#int_RDA |
|
|
8 |
void RDA_isr(void) |
|
|
9 |
{ |
|
|
10 |
int n; |
|
|
11 |
output_B(0x55); |
|
|
12 |
for(n=0;n<(MAX_SLOVO*2);n++) |
|
|
13 |
{ |
|
|
14 |
napis[n]=getc(); |
|
|
15 |
restart_WDT(); |
|
|
16 |
} |
|
|
17 |
} |
|
|
18 |
|
181 |
svejda |
19 |
void main() |
|
|
20 |
{ |
|
|
21 |
|
218 |
kaklik |
22 |
int slovo,pismeno,sloupec,j; |
181 |
svejda |
23 |
|
218 |
kaklik |
24 |
|
182 |
svejda |
25 |
const int8 pis[2*5]={0b00000001,0b11110110,0b11110110,0b11110110,0b00000001, |
|
|
26 |
0b00000001,0b11110110,0b11110110,0b11110110,0b00000001}; |
|
|
27 |
|
181 |
svejda |
28 |
setup_adc_ports(NO_ANALOGS); |
|
|
29 |
setup_adc(ADC_OFF); |
|
|
30 |
setup_psp(PSP_DISABLED); |
|
|
31 |
setup_spi(SPI_SS_DISABLED); |
|
|
32 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
218 |
kaklik |
33 |
setup_wdt(WDT_2304MS); |
181 |
svejda |
34 |
setup_timer_1(T1_DISABLED); |
|
|
35 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
36 |
setup_comparator(NC_NC_NC_NC); |
|
|
37 |
setup_vref(FALSE); |
|
|
38 |
|
218 |
kaklik |
39 |
enable_interrupts(INT_RDA); |
|
|
40 |
enable_interrupts(GLOBAL); |
|
|
41 |
|
|
|
42 |
set_adc_channel(0); |
|
|
43 |
|
181 |
svejda |
44 |
while(TRUE) |
|
|
45 |
{ |
218 |
kaklik |
46 |
for(slovo=0;slovo<2;slovo++) |
|
|
47 |
for(j=0;j<=100;j++) // Jedno slovo se zobrazi stokrat |
182 |
svejda |
48 |
{ |
218 |
kaklik |
49 |
while(read_adc()<10); // Cekani na magnet |
|
|
50 |
|
|
|
51 |
for(pismeno=0;pismeno<MAX_SLOVO;pismeno++) |
182 |
svejda |
52 |
{ |
218 |
kaklik |
53 |
for(sloupec=0;sloupec<5;sloupec++) |
182 |
svejda |
54 |
{ |
218 |
kaklik |
55 |
output_B(pis[(napis[slovo*MAX_SLOVO+pismeno]-0x40)*5+sloupec]); |
|
|
56 |
delay_ms(1); |
182 |
svejda |
57 |
} |
|
|
58 |
delay_ms(2); |
|
|
59 |
} |
|
|
60 |
} |
|
|
61 |
} |
181 |
svejda |
62 |
} |