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

Binary and Ascii ...

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







Binary and Ascii ...
PostPosted: Mon Jan 06, 2003 11:47 am     Reply with quote

I have some displays with four digits which use ascii codes for every digit. that means you have to send for every number the ascii code to the display! now the problem is, i am working with binary numbers! i need a simple pic programm, which can convert a binary number into a 4 digit ascii number.
i need it in both directions....
so if someone has an idea or a link or anything..
tell me .. Smile
___________________________
This message was ported from CCS's old forum
Original Post ID: 10468
Tomi
Guest







Re: Binary and Ascii ...
PostPosted: Mon Jan 06, 2003 11:52 am     Reply with quote

Check out printf() sprintf() and atoi() functions, e.g.:
printf(SendaByteToDisplay,"\%04u",myvar);

:=I have some displays with four digits which use ascii codes for every digit. that means you have to send for every number the ascii code to the display! now the problem is, i am working with binary numbers! i need a simple pic programm, which can convert a binary number into a 4 digit ascii number.
:=i need it in both directions....
:=so if someone has an idea or a link or anything..
:=tell me .. <img src="http://www.ccsinfo.com/pix/forum/smile.gif" border="0">
___________________________
This message was ported from CCS's old forum
Original Post ID: 10469
DOPO
Guest







Re: Binary and Ascii ...
PostPosted: Mon Jan 06, 2003 12:13 pm     Reply with quote

i am using the CC5X from Knuddson Data ..
Its a C-Compiler for MPLAB..
I'll try .. :)

:=Check out printf() sprintf() and atoi() functions, e.g.:
:=printf(SendaByteToDisplay,"\%04u",myvar);
:=
:=:=I have some displays with four digits which use ascii codes for every digit. that means you have to send for every number the ascii code to the display! now the problem is, i am working with binary numbers! i need a simple pic programm, which can convert a binary number into a 4 digit ascii number.
:=:=i need it in both directions....
:=:=so if someone has an idea or a link or anything..
:=:=tell me .. <img src="http://www.ccsinfo.com/pix/forum/smile.gif" border="0">
___________________________
This message was ported from CCS's old forum
Original Post ID: 10470
sar



Joined: 08 Sep 2003
Posts: 36

View user's profile Send private message

Re: Binary and Ascii ...
PostPosted: Tue Jan 07, 2003 11:18 am     Reply with quote

Hello

Here is some sample code for your application at:

<a href="http://home.attbi.com~brucecannon/sculptures/time_of_your_life/time_of_your_life_technical_notes.htm" TARGET="_blank">http://home.attbi.com~brucecannon/sculptures/time_of_your_life/time_of_your_life_technical_notes.htm</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 10508
sar



Joined: 08 Sep 2003
Posts: 36

View user's profile Send private message

Re: Binary and Ascii ...
PostPosted: Tue Jan 07, 2003 11:22 am     Reply with quote

Hello
I think the link was bad:

<a href="http://home.attbi.com/~brucecannon/sculptures/time_of_your_life/time_of_your_life_technical_notes.htm" TARGET="_blank">http://home.attbi.com/~brucecannon/sculptures/time_of_your_life/time_of_your_life_technical_notes.htm</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 10509
Mircea



Joined: 12 Jan 2007
Posts: 7
Location: Europe

View user's profile Send private message

PostPosted: Fri Jan 12, 2007 9:29 am     Reply with quote

To get the ASCII code:
Code:
int8 GET_ASCII (int8 value )
{
 value = '0' + (value & 0x0F);    // only 4 bits
 if(value>57) value+=7;
 return value;
}
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