// PROTO
void MorseTX(char *letra,uint32_t Velo);
void Morse_Encoder (char *morse, uint32_t Velo );
//
char Buffer_Tx [] = "VVV LU7FJ LU7FJ FF99QE TST";
*/ EJEMPLO
Morse_Encoder (Buffer_Tx,30);
*/
char A[] = {'.','-',0};
char B[] = {'-','.','.','.',0};
char C[] = {'-','.','-','.',0};
char D[] = {'-','.','.',0};
char E[] = {'.',0};
char F[] = {'.','.','-','.',0};
char G[] = {'-','.','.',0};
char H[] = {'.','.','.','.',0};
char I[] = {'.','.',0};
char J[] = {'.','-','-','-',0};
char K[] = {'-','.','-',0};
char L[] = {'.','-','.','.',0};
char M[] = {'-','-',0};
char N[] = {'-','.',0};
char O[] = {'-','-','-',0};
char P[] = {'.','-','-','.',0};
char Q[] = {'-','-','.','-',0};
char R[] = {'.','-','.',0};
char S[] = {'.','.','.',0};
char T[] = {'-',0};
char U[] = {'.','.','-',0};
char V[] = {'.','.','.','-',0};
char W[] = {'.','-','-',0};
char X[] = {'-','.','.','-',0};
char Y[] = {'-','.','-','-',0};
char Z[] = {'-','-','.','.',0};
char SPACE[] = {' ',0};
char n1 []= {'.','-','-','-','-',0};
char n2 []= {'.','.','-','-','-',0};
char n3 []= {'.','.','.','-','-',0};
char n4 []= {'.','.','.','.','-',0};
char n5 []= {'.','.','.','.','.',0};
char n6 []= {'-','.','.','.','.',0};
char n7 []= {'-','-','.','.','.',0};
char n8 []= {'-','-','-','.','.',0};
char n9 []= {'-','-','-','-','.',0};
char n0 []= {'-','-','-','-','-',0};
void MorseTX( char *letra, uint32_t Velo )
{
uint32_t vel ;
uint32_t RV = 50 - Velo;
do
{
char x = (*letra);
switch(x)
{
case '.':
PORTC |= (1<<PORTC4);
for (vel = 0; vel < RV; vel++){_delay_ms(2);}
PORTC &= ~(1<<PORTC4);
for (vel = 0; vel < RV; vel++){_delay_ms(2);}
break;
case '-':
PORTC |= (1<<PORTC4);
for (vel = 0; vel < RV; vel++){_delay_ms(6);}
PORTC &= ~(1<<PORTC4);
for (vel = 0; vel < RV; vel++){_delay_ms(2);}
break;
case ' ':
PORTC &= ~(1<<PORTC4);
for (vel = 0; vel < RV; vel++){_delay_ms(8);}
break;
}
} while(*++letra) ;
for (vel = 0; vel < RV; vel++){_delay_ms(4);}
}
void Morse_Encoder (char *morse, uint32_t vpm )
{
do
{
char x = (*morse);
switch(x)
{
case 'A':
MorseTX(A,vpm);
break;
case 'B':
MorseTX(B,vpm);
break;
case 'C':
MorseTX(C,vpm);
break;
case 'D':
MorseTX(D,vpm);
break;
case 'E':
MorseTX(E,vpm);
break;
case 'F':
MorseTX(F,vpm);
break;
case 'G':
MorseTX(G,vpm);
break;
case 'H':
MorseTX(H,vpm);
break;
case 'I':
MorseTX(I,vpm);
break;
case 'J':
MorseTX(J,vpm);
break;
case 'K':
MorseTX(K,vpm);
break;
case 'L':
MorseTX(L,vpm);
break;
case 'M':
MorseTX(M,vpm);
break;
case 'N':
MorseTX(N,vpm);
break;
case 'O':
MorseTX(O,vpm);
break;
case 'P':
MorseTX(P,vpm);
break;
case 'Q':
MorseTX(Q,vpm);
break;
case 'R':
MorseTX(R,vpm);
break;
case 'S':
MorseTX(S,vpm);
break;
case 'T':
MorseTX(T,vpm);
break;
case 'U':
MorseTX(U,vpm);
break;
case 'V':
MorseTX(V,vpm);
break;
case 'W':
MorseTX(W,vpm);
break;
case 'X':
MorseTX(X,vpm);
break;
case 'Y':
MorseTX(Y,vpm);
break;
case 'Z':
MorseTX(Z,vpm);
break;
case ' ':
MorseTX(SPACE,vpm);
break;
case '0':
MorseTX(n0,vpm);
break;
case '1':
MorseTX(n1,vpm);
break;
case '2':
MorseTX(n2,vpm);
break;
case '3':
MorseTX(n3,vpm);
break;
case '4':
MorseTX(n4,vpm);
break;
case '5':
MorseTX(n5,vpm);
break;
case '6':
MorseTX(n6,vpm);
break;
case '7':
MorseTX(n7,vpm);
break;
case '8':
MorseTX(n8,vpm);
break;
case '9':
MorseTX(n9,vpm);
break;
}
} while (*++morse);
}
No hay comentarios.:
Publicar un comentario