How to sent real (double) data from PSOC 5LP with usb uart and read it in c# ?

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

cross mob
HaHa_285681
Level 3
Level 3
First like given

I am new for this area and I need a help for sending real numbers from PSOC 5LP to PC for reading it with c# .

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

Since the representation of floats as binary may vary from your source and target machines, best would be to use printf() ans scanf().

   

Easiest on PSoC5 side is fprintf() and then send the converted srting over USBUART and on the other side receive a string that can be converted using fscanf().

   

 

   

Bob

0 Likes
HaHa_285681
Level 3
Level 3
First like given

 Sorry I didn't explain situation clearly, I have some graph (with real values like "2.036" or "-0.145") in my PSOC 5LP ( it has not end and gives value every 0.001 sec) I want to sent this graph's values to PC with usb uart for plotting this graph on PC. Which function (USBUART_PutData(), USBUART_PutString(), USBUART_PutChar(), USBUART_PutCRLF()) can I use in this situation and which kind of data must I sent to PC and ?

   
        
   
    regards,   
   
    Hakob   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

As I said: Convert the double value into a string with sprintf() and then send the string with USBUART_PutString()

   

 

   

Bob

0 Likes
HaHa_285681
Level 3
Level 3
First like given

 Thanks for answer, now i can convert data to int then send it with PutData() and then again convert it to double, this is better for my project.

0 Likes