Problem with transfer data from PC to HID device (PSoC 3)

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi, All!

   

I'm sorry for my bad English!

   

I make HID device for transfer in real time data from I2C sensors to PC. But I have some problems with transfer data from PC to PSoC. Data is transmitted after a long delay or not at all transmitted. This data on the sensors scale.

   

And another question, how best to transfer the data type float ?

   

Oleg

0 Likes
1 Solution
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Note that with Creator 3.0, newlib-nano is used by default. For that, floating point support in all *printf() functions need to be enabled explicitely: http://www.cypress.com/?id=4&rID=87354

View solution in original post

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

Since the implementation of floats on a PSoC may differ from a float on your PC I would suggest to write them out as a string using sprintf() and read them back in with sscanf(). This will insure a common coding over the interface.

   

 

   

Merry Chistmas
Bob

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Convert floats to character string and send as a NUL terminated string,

   

sprintf() (convert into a char buffer) will do that nicely with formatting.

   

 

   

Then use atof() (or its equivalent) on PC side to convert string back to

   

float.

   

 

   

Attached sprintf (printf) formatting string reference.

   

 

   

Regards, Dana.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Note that with Creator 3.0, newlib-nano is used by default. For that, floating point support in all *printf() functions need to be enabled explicitely: http://www.cypress.com/?id=4&rID=87354

0 Likes
Anonymous
Not applicable

Thanks for the reply!

Anybody can give an example how to transfer string data?

and what about the first question? Why do not always transmit data from a PC to PSoC or transferred after a long delay?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You have seen the following ap note and ones listed at bottom

   

of this page ?

   

 

   

    

   

          

   

http://www.cypress.com/?rID=39553    AN56377

   

 

   

 

   

Regards, Dana.

0 Likes