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.

reception of data by PC from MCU

Status
Not open for further replies.

Munib

Advanced Member level 4
Joined
Jun 11, 2004
Messages
114
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Activity points
1,129
we know that when we send the data in the form of bytes from mcu to pc, the windows os will convert this bytes of data from binary to their ascii code, now if i want the data to convert back to their decimal form rather than ascii form , then what should be done for that
 

OS doesn't convert data to ASCII.. only if you are using a terminal program.
 

Termindal Program?
can u please ellaborate a bit more
 

Jdhar is talking about HyperTerminal from Windows OS.
If you send from MCU to PC 00110000 and receive this bit stream in HyperTerminal you'll see on the screen 0 (as converted to ASCII).
But if you use a program made by you, can display as convenient (hex, BCD, binary, ASCII).
 

Munib said:
we know that when we send the data in the form of bytes from mcu to pc, the windows os will convert this bytes of data from binary to their ascii code, now if i want the data to convert back to their decimal form rather than ascii form , then what should be done for that

In displaying data in terminals, you must convert your binary values or hex values to ASCII standard codes. Say for example you have an operation of 1 + 1 =2, you cannot directly send 2 into your terminal to display it, it will give you an ASCII character given by that number, instead you must convert 2 first into its ASCII character equivalent to display it as 2.
 

well tahts ok

but my problem is taht i am taking input from my sensor, this input is stored in mcu and then its sent to pc, where i receive it in ascii, during all this time i dont have any chance of editing it, can any one now guide me to solve the isssue
 

now, what program do you use to receive the byte?

you can write your own program to receive it and handle rite.
 

hmm i guess i was wrong that i cant handle that byte of data received from the sensor

any way
though it might sound like that i am aklsing for spooon feeding but literally i can not understand that how i am going to convert a my ascii code back to decimal or hex form, the stuff which i receive on the pc side are just symbols, how can i revert them to meaning ful information,

Added after 2 minutes:

instead you must convert 2 first into its ASCII character equivalent to display it as 2.


and wat doe sthat suppose to mean
 

Hi Munib,

What type of sensor and mcu are you using ?
If you provide this information I'll show you a way to solve the problem.

regards,
silvio
 

well i am not going for any general sensor, i have multiple sensors (temperature, pressure etc) so i cant be specific ,
 

Munib said:
well i am not going for any general sensor, i have multiple sensors (temperature, pressure etc) so i cant be specific ,

Well, let say that converting data that sensor gives you, as results a value between 00000000 and 11111111. That is 0x00 - 0xFF, so a range between 0 and 255 decimal.
Let say the value you want to send is 0x7F or 127 decimal.
If you convert 0x7F to ASCII you must send 0x31 then 0x32 then 0x37.
Thus, on hyperterminal PC program you get printed clearly 127 and not a sign for non printable character 0x7F. In your own program you don't have to convert at transmission. Your program will do the job for displaying.

Obvious, the value 0x7F means nothing for your pressure sensor.
I mean 127 decimal could be the middle range for your measurements.
Thus 127 could mean 50 psi from a range between 0 and 100 psi.
Obvious you would want to send 50 instead 127, which seems much closer to the real measure.
But the purpose of the above example is just to give you some ideas.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top