anitha
Joined: 16 Aug 2013 Posts: 6
|
serial communication |
Posted: Tue Oct 22, 2013 12:26 am |
|
|
How to send array of hex codes in ASCII format ? I have problem in else part.
Code: |
#include<18f4520.h>
#fuses XT,NOWDT
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_c7)
#define SWITCH_PIN PIN_B5
void main()
{
int i;
char a[10];
if(input(SWITCH_PIN)==0)
{
char a[]={20, 96, 21, 114, 22, 88, 23, 5, 147, 159, 194, 134, 140};
for(i=0;i<=a[i]+2;i++)
{
printf("%c",a[i]);
delay_ms(100);
}
}
else
{
char a[]=(20, 96, 21, 114, 22, 88, 23, 5, 183, 7, 159, 146, 164);
for(i=0;i<=a[i]+3;i++)
{
printf("%c",a[i]);
delay_ms(100);
}
}
} |
|
|