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 CCS Technical Support

I want to send HEX values by using USART.

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



Joined: 01 Dec 2019
Posts: 1

View user's profile Send private message

I want to send HEX values by using USART.
PostPosted: Sun Dec 01, 2019 10:55 pm     Reply with quote

I want to send HEX values like "0xEF" or Decimal values is 239 to fingerprint sensor is using uart. but I try some function on ccs like

printf("%X",0xEF);

and I used oscilloscope capture signal to compare with ascii code
https://www.ascii-code.com/

and it show

01000101 "E" and 01000110 "F"

but i want

11101111 0xEF or 239

somebody please tell me to write the code Thank you
Embarassed Embarassed Embarassed
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Sun Dec 01, 2019 11:08 pm     Reply with quote

printf("0x%02X",0xEF);

or to send the 239:

printf("%u",0xEF);
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 02, 2019 6:34 am     Reply with quote

He actually wants the raw hex byte, so it would be:
Code:

printf("%c", 0xEF);

or
Code:
putc(0xEF);
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Mon Dec 02, 2019 7:42 am     Reply with quote

Ah. I thought he wanted the Hex in the standard format.....
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