#include "iostm8s003k3.h" int c=0;
int a=0;
int i=0;
int b=0;
int stroka;
char element;
unsigned long dummy;
//=================================
void delay (void) //Задержка
{
for (dummy =0; dummy <2000; dummy ++);
}
//=================================
void dash (void) //тире
{
int c=3;
BEEP_CSR_bit.BEEPEN=1;
PB_ODR_bit.ODR7=1;
while(c)
{
c--;
delay();
}
BEEP_CSR_bit.BEEPEN=0;
PB_ODR_bit.ODR7=0;
delay();
}
//=================================
void dot (void) //точка
{
BEEP_CSR_bit.BEEPEN=1;
PB_ODR_bit.ODR7=1;
delay();
BEEP_CSR_bit.BEEPEN=0;
PB_ODR_bit.ODR7=0;
delay();
}
//=================================
void pause_3 (void)
{
int c=3;
BEEP_CSR_bit.BEEPEN=0;
while(c)
{
c--;
delay();
}
}
//=================================
void pause_7 (void)
{
int c=7;
BEEP_CSR_bit.BEEPEN=0;
while(c)
{
c--;
delay();
}
}
//=================================
int main( void )
{
PB_DDR_bit.DDR7=1; //Пин 7 настроен на выход
PB_CR1_bit.C17=1;
PB_CR2_bit.C27=1;
PD_DDR_bit.DDR5=1; //Пин 7 настроен на выход
PD_CR1_bit.C15=1;
PD_CR2_bit.C25=1;
PD_ODR_bit.ODR5=0;
int abc[43][7] = {
{1,1,1,1,1,3}, // 0x30 0 48
{0,1,1,1,1,3}, // 0x31 1 49
{0,0,1,1,1,3}, // 0x32 2 50
{0,0,0,1,1,3}, // 0x33 3 51
{0,0,0,0,1,3}, // 0x34 4 52
{0,0,0,0,0,3}, // 0x35 5 53
{1,0,0,0,0,3}, // 0x36 6 54
{1,1,0,0,0,3}, // 0x37 7 55
{1,1,1,0,0,3}, // 0x38 8 56
{1,1,1,1,0,3}, // 0x39 9 57
{5,3}, // 0x3A : 58 пауза 7 сек.
{1,0,1,0,1,0}, // 0x3B ; 59
{1,0,1,0,1,0}, // 0x3C < 60
{1,0,1,0,1,0}, // 0x3D + 61
{1,0,1,0,1,0}, // 0x3E > 62
{1,0,1,0,1,0}, // 0x3F ? 63
{1,0,1,0,1,0}, // 0x40 @ 64
{0,1,3}, // 0x41 A 65
{1,0,0,0,3}, // 0x42 B 66
{1,0,1,0,3}, // 0x43 C 67
{1,0,0,3}, // 0x44 D 68
{0,3}, // 0x45 E 69
{0,0,1,0,3}, // 0x46 F 70
{1,1,0,3}, // 0x47 G 71
{0,0,0,0,3}, // 0x48 H 72
{0,0,3}, // 0x49 I 73
{0,1,1,1,3}, // 0x4A J 74
{1,0,1,3}, // 0x4B K 75
{0,1,0,0,3}, // 0x4C L 76
{1,1,3}, // 0x4D M 77
{1,0,3}, // 0x4E N 78
{1,1,1,3}, // 0x4F O 79
{0,1,1,0,3}, // 0x50 P 80
{1,1,0,1,3}, // 0x51 Q 81
{0,1,0,3}, // 0x52 R 82
{0,0,0,3}, // 0x53 S 83
{1,3}, // 0x54 T 84
{0,0,1,3}, // 0x55 U 85
{0,0,0,1,3}, // 0ч56 V 86
{0,1,1,3}, // 0x57 W 87
{1,0,0,1,3}, // 0x58 X 88
{1,0,1,1,3}, // 0x59 Y 89
{1,1,0,0,3} // 0x5A Z 90
};
//=================================
char baecon[]={"BEACON TX 439.143 QTH KN46RW"};
BEEP_CSR_bit.BEEPDIV=0x1E;
BEEP_CSR_bit.BEEPSEL=0x3;
while(1)
{
for(i=0;i<27;i++)
{
b=0;
element = baecon[i];
if(element==0x20)
{
a=10;
}
else
{
a=element-48;
}
for(b=0;b<8;b++)
{
if(abc[a][b]==3)
{
pause_3();
b=8;
}
else
{
if(abc[a][b]==5) pause_7();
if(abc[a][b]==1) dash();
if(abc[a][b]==0) dot();
}
}
}
}
}