This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sending 3 integer number via CDC in LPc-1768 to usb port

I want to send 3 numbers or more with own function in CDC to send directely to usp port to the PC.

i try this but the sending numbers is not exactely the source numbers, and is randomly changes.
i use a delay between sending periods, but the result is not good.
please help to use a best method and quick.

so i think if i change the 3 number to a char array , and send that in a packet all will be OK.
but i dont know how i do that.

this is my function :

void Usb_SendChar(uint32_t values)
{ uint32_t valuebuf[4]; uint8_t i,n;

USB_ClearEPBuf (CDC_DEP_IN); valuebuf[0] = values%10+ '0'; valuebuf[1] = values/10%10+ '0'; valuebuf[2] = values/10/10%10+ '0'; valuebuf[3] = values/10/10/10%10+ '0';

for(i=0;i<4;i++){ USB_WriteEP (CDC_DEP_IN, (unsigned char *)&valuebuf[i],1);

for(n=0;n<80;n++);
}

USB_WriteEP (CDC_DEP_IN, " ", 2);
}

Regards