-
1. Re: data format of usb_uart
prakhar.kumar Jun 19, 2014 11:59 PM (in response to prakhar.kumar)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.
-
2. Re: data format of usb_uart
bob.marlowe Jun 20, 2014 12:41 AM (in response to prakhar.kumar)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
-
3. Re: data format of usb_uart
prakhar.kumar Jun 20, 2014 2:38 AM (in response to prakhar.kumar)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.
-
4. Re: data format of usb_uart
bob.marlowe Jun 20, 2014 2:49 AM (in response to prakhar.kumar)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.htmlBob
-
5. Re: data format of usb_uart
prakhar.kumar Jun 20, 2014 5:54 AM (in response to prakhar.kumar)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.
-
6. Re: data format of usb_uart
user_49271930 Jun 22, 2014 2:20 PM (in response to prakhar.kumar)
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.
-
ADC_USBUART.zip 213.1 K
-
-
-
-
-
-
11. Re: data format of usb_uart
bob.marlowe Jun 23, 2014 3:40 AM (in response to prakhar.kumar)Spellbound?
Bob