CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

serial communication

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
anitha



Joined: 16 Aug 2013
Posts: 6

View user's profile Send private message

serial communication
PostPosted: Tue Oct 22, 2013 12:26 am     Reply with quote

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);
     }
  }

}
oxo



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

PostPosted: Tue Oct 22, 2013 1:06 am     Reply with quote

See here

http://www.cdf.toronto.edu/~ajr/209/notes/printf.html

%X is what you need, if I understand you correctly
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group