lpcware

write Register values to usb

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by AmirHejazi on Wed Feb 06 16:57:29 MST 2013
Hi every body

I suppose to send  timer register values to USB,using LPC1768 USBHostlite, to save in computer and use them for further Analysis.
consider that register value is "97" and changes every period.

I want to send this value, using File_Write. these are some line of the code:
_______________________________
USB_INT32U  temp;
.
.
temp=97;    //for example
*UserBuffer=temp;
.
.
FILE_Write(fdw,UserBuffer,1);
------------------------------
but the result is ascii codes for 97. so it writes an "a" to usb(not displays 97).
I found that i must convert the timer value to string using sprintf function.
and i found that the structure is as below:
___________________________________
char buf;
.
.
sprintf(buf,"%d",bytes_read);
-----------------------------------

but how should i use the "buf" as input for file_write ?
type of UserBuffer is uint8_t but type of buf is char

please help me
thanks

Outcomes