data format of usb_uart

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable
0 Likes
11 Replies
Anonymous
Not applicable

Hi everybody,

   

Sorry for the previous blank post.

   

I am using usbuart in my project to display the ADC output data on hyperterminal using usbuart.

   

Now ,i wish to know the format of the data that comes through usbuart.(Is it hex,ASCII?)

   

This is because i am trying to plot the data from  usbuart on labview.However when i try to convert the string read from usbuart to a number using <decimal string to number function> ,i get zero as the output each time.So please guide me about this strange problem.

   

Thanks in advance.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Sending data via USBUART implies no data conversion at all. What you send is bit-by bit retrieved at the receiver side.

   

So when data should be interpreted on the receiver side as float, bytes or ints it would be safer to convert the data at the sender's side to ascii using sprintf().

   

 

   

Bob

0 Likes
Anonymous
Not applicable

 Thanks for the reply Bob.

   

So if get an integer as adc output using adc_getresult32() then using sprintf() ,should i convert it to ascii?

   

This is because till now i was converting it to decimal using %d.

   

Also could you please tell me format for using sprintf to convert an integer to ascii.

   

Sorry ,for so many questions at once.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When using sprintf() the format specifier %d converts 16-bit integers to an ascii string.
Have a look here publications.gbdirect.co.uk/c_book/chapter9/formatted_io.html

   

 

   

Bob

0 Likes
Anonymous
Not applicable

 I know this is a bit out of scope of the psoc forum ,but could you tell me what could be the possible reason for the ascii string not getting converted to number in labview when i use <string to number vi> ,even though i use %d format specifier.

   

Thanks.

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received


Difficult without seeing the project to understand your problem.
In the topic ADC -> USB is my project USB_16bit_ADC.cywrk.Archive01.zip
Unfortunately I have a very ancient LabVIEW_5.0 but maybe you can help
LabVIEW project attached below.
 

0 Likes
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Spellbound?

   

 

   

Bob

0 Likes