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

cross mob

PSoC® 3/5 USBUART: Message to HyperTerminal When a COM Port Is Opened - KBA89227

PSoC® 3/5 USBUART: Message to HyperTerminal When a COM Port Is Opened - KBA89227

Anonymous
Not applicable
Version: **

 

Question: How do you make the USBUART device wait until a COM port is opened on the PC and display the message “Program Starts” on the terminal?

 

Answer:

Bind the USBUART device to the standard Communications Device Class (CDC) driver of Windows®. When you use the terminal to open a COM port on the PC, a SET_LINE_CODING command is sent from HyperTerminal.

In the firmware, you can loop to wait for a SET_LINE_CODING command. Multiple such requests can be sent from the host based on which application and driver are being used. This approach is useful when using HyperTerminal with the standard drivers.

The following code snippet implements this approach, and can be used when using the USBUART component and its generated APIs:

while(Flag)  {    state = USBUART_1_IsLineChanged();  if (state & USBUART_1_LINE_CODING_CHANGED)  {  sprintf(&buffer, "Program starts\n\r");  while(USBUART_1_CDCIsReady() == 0u); /* Wait till component is ready                                                to send more data to the PC */  count = strlen(&buffer);  USBUART_1_PutData(buffer, count);  Flag = 0;  } }
0 Likes
713 Views
Contributors