Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Ascii -- decimal to character conversion -- mikroc

Status
Not open for further replies.

ashwanthh

Junior Member level 2
Joined
Oct 21, 2010
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,443
Hi all,

I am new to Mikroc, For my project, i want to send the character of the decimal value via usart....

For eg:

In ASCII TABLE

Dec Char

22 SYN

27 ESC

32 SPC

I want to send the character value of 22(which is SYN)....But, I dont know how to convert the above... Please, some one help me with the above conversion.....

Thanks in Advance...
 

it is very simple if you send decimal value 22 it will be automatically understood as the character "SYN" because decimal 22 is the ASCII value for SYN, Similarly if you transmit 48 decimal then it will be understood as ASCII '0'......
So you don't need any conversion if you want to send the corresponding char of the decimal value..
 

Sir,
Thanks for your reply,
In my program, the value '27' is stored in array[0],

If i command ,

UART1_Write_Text(array[0]); // I get the output as '27'

UART1_Write(array[0]); // I get the out put '!' which is the ascii char value of '33'(I hope its the address)..

I want the output of char '27' which is 'ESC'.... so, what command should i give ... Please, help me/....
 

Please clarify what you want to see.
If you transmit the character with number 48 (Decimal) that is exactly what gets sent, one byte containing that value (00110000 binary). It is up to the program receiving the number to interpret it as an ASCII value, decimal value or other radix.

Brian.
 

The values
22 decimal, 16 hex, 026 octal, SYN char
are the same.
now it depends upon you or the application on which you are viewing the data how you interpret it.
I guess you are using hyper terminal may be thats why it is showing you those characters because the values you are sending are not characters exactly that can be shown. try to send decimal value 10 which is Line feed and hyper terminal will move the cursor to next line also try decimal 13 which is Carriage return and the hyper terminal will shift the cursor to the start of the line...
Still confused then you must post some more details about your project on which software you are viewing data
and what exactly do you want..?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top