Have you made the variable Volatile that is inportant. Please post your code.
To declare a variable volatile, include the keyword volatile before or after the data type in the variable definition. For instance both of these declarations will declare foo to be a volatile integer:
volatile int foo;
int volatile foo;
Now, it turns out that pointers to volatile variables are very common. Both of these declarations declare foo to be a pointer to a volatile integer:
volatile int * foo;
int volatile * foo;
Volatile pointers to non-volatile variables are very rare (I think I've used them once), but I'd better go ahead and give you the syntax:
int * volatile foo;
And just for completeness, if you really must have a volatile pointer to a volatile variable, then:
This all are Cypress API Funcioins (USBUART).
Problem is when MCU first sends Data it goes into the USBTXBuffer, but when no PC connected the Data stays in the Buffer, next Time when the MCU sends the next data it will be hangs by "wait until buffer clear".
So I need a Solution to find out if a PC is connected and ready to receive or not...
Put a counter into the while-loop and break out when waiting too long.
Yes but this slows the system when no PC is connected, no other was to detect if a PC is ready to receive? Like DTR or something
Those options will not be possible with USBUART I guess, unless you change code in Kitprog.