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