View previous topic :: View next topic |
Author |
Message |
DOPO Guest
|
Binary and Ascii ... |
Posted: Mon Jan 06, 2003 11:47 am |
|
|
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 ..
___________________________
This message was ported from CCS's old forum
Original Post ID: 10468 |
|
|
Tomi Guest
|
Re: Binary and Ascii ... |
Posted: Mon Jan 06, 2003 11:52 am |
|
|
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 ... |
Posted: Mon Jan 06, 2003 12:13 pm |
|
|
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
|
Re: Binary and Ascii ... |
Posted: Tue Jan 07, 2003 11:18 am |
|
|
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
|
Re: Binary and Ascii ... |
Posted: Tue Jan 07, 2003 11:22 am |
|
|
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
|
|
Posted: Fri Jan 12, 2007 9:29 am |
|
|
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;
} |
|
|
|
|