#include ".\infra.h"
#define MAX_SLOVO 10 // Maximalni pocet znaku ve slovu
int8 napis[MAX_SLOVO+1];
int8 otacky;
const int8 logo[MAX_SLOVO+1]={'[','^','_','_',']',96,'^','_','_','a',0}; // [blesk] E4A [blesk]
const int8 rok[MAX_SLOVO+1]={'[','[',92,'[','E',']','A','[',92,'[',0}; // 2004-2008
#int_RDA
void RDA_isr(void)
{
int n;
output_B(0x55);
for(n=0;n<MAX_SLOVO;n++)
{
napis[n]=getc();
}
}
void LED_print()
{
unsigned int slovo,pismeno,sloupec,j;
3
const int8 pis[38*5]={0b00000001,0b11110110,0b11110110,0b11110110,0b00000001, //A
0b00000000,0b01110110,0b01110110,0b01110110,0b10001001, //B
0b10000001,0b01111110,0b01111110,0b01111110,0b10111101, //C
0b00000000,0b01111110,0b01111110,0b01111110,0b10000001, //D
0b00000000,0b01110110,0b01110110,0b01111110,0b01111110, //E
0b00000000,0b11110110,0b11110110,0b11111110,0b11111110, //F
0b10000001,0b01111110,0b01110110,0b01110110,0b10000101, //G
0b00000000,0b11110111,0b11110111,0b11110111,0b00000000, //H
0b01111110,0b01111110,0b00000000,0b01111110,0b01111110, //I
0b10111110,0b01111110,0b01111110,0b01111110,0b10000000, //J
0b00000000,0b11110111,0b11110111,0b11101011,0b00011100, //K
0b00000000,0b01111111,0b01111111,0b01111111,0b01111111, //L
0b00000000,0b11111110,0b11110000,0b11111110,0b00000000, //M
0b00000000,0b11101111,0b11011111,0b10111111,0b00000000, //N
0b10000001,0b01111110,0b01111110,0b01111110,0b10000001, //O
0b00000000,0b11110110,0b11110110,0b11110110,0b11111001, //P
0b10000001,0b01111110,0b01111110,0b01111110,0b00000001, //Q
0b00000000,0b11110110,0b11110110,0b11110110,0b00001001, //R
0b10111001,0b01110110,0b01110110,0b01110110,0b10001101, //S
0b11111110,0b11111110,0b00000000,0b11111110,0b11111110, //T
0b10000000,0b01111111,0b01111111,0b01111111,0b10000000, //U
0b11000000,0b10111111,0b01111111,0b10111111,0b11000000, //V
0b10000000,0b01111111,0b10000000,0b01111111,0b10000000, //W
0b00011100,0b11101011,0b11110111,0b11101011,0b00011100, //X
0b11111000,0b11110111,0b00000111,0b11110111,0b11111000, //Y
0b00011110,0b01101110,0b01110110,0b01111010,0b01111100, //Z
0b11111111,0b11111111,0b11111111,0b11111111,0b11111111, //mezera
0b00010111,0b00110011,0b01010101,0b11100110,0b11110111, //blesk
0b11110111,0b11110111,0b11110111,0b11110111,0b11110111, //pomlka
0b00000000,0b01111110,0b01111110,0b01111110,0b00000000, //0
0b01111011,0b01111101,0b00000000,0b01111111,0b01111111, //1
0b00111101,0b01011110,0b01101110,0b01110110,0b01111001, //2
0b10111101,0b01111110,0b01110110,0b01110110,0b10001001, //3
0b11110000,0b11110111,0b11110111,0b00000001,0b11110111, //4
0b10111000,0b01110110,0b01110110,0b01110110,0b10001110, //5
0b10000001,0b01110110,0b01110110,0b01110110,0b10001101, //6
0b11111110,0b11111110,0b00001110,0b11110110,0b11111000, //7
0b10001001,0b01110110,0b01110110,0b01110110,0b10001001, //8
0b10111001,0b01110110,0b01110110,0b01110110,0b10000001, //9
};
while(read_adc()<9); // Cekani na magnet
delay_ms(10);
for(pismeno=0;pismeno<MAX_SLOVO;pismeno++)
{
for(sloupec=0;sloupec<5;sloupec++)
{
output_B(pis[(napis[pismeno]-0x41)*5+sloupec]);
delay_us(500);
}
output_B(0xFF);
delay_us(500);
}
}
void main()
{
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_INTERNAL);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_wdt(WDT_2304MS);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
set_adc_channel(0); // Prevodnik pro Hall
output_B(0xFF); // Zhasneme
otacky=0;
napis[0]=0;
while(TRUE)
{
if (napis[0]!=0)
{
LED_print();
}
else
{
strcpy(napis,logo);
}
}
}