Quantcast
Channel: Forum - Recent Threads
Viewing all articles
Browse latest Browse all 5781

Uart write operation

$
0
0

Hi all !

 

I'm trying to write to a UART the contents of the buffer modBus however the message that i get are the values of  0x20.

For example, let's say that the buffer modBus is loaded with the values 0x13,0x22, 0x10.

In that situation  qtd_B_MB  would be 3. 

Therefore i expect to get the values, 0x13,0x22 and 0x10 on my prompt, but what i get are the values 0x20,0x20,0x20 which

should be loaded to the modBus buffer after writing to the UART.

For what i have seen when the command write is called , the tx operation is not fully executed, and  the program keeps running 

until it reaches the part of the code that cleans the buffer, and what i get are the values 0x20. 

 

This is the part of the code that i refering to : 

/***********************************************************/

g_uart0.p_api->open(g_uart0.p_ctrl,g_uart0.p_cfg);

//Write contents of modBus buffer.

g_uart0.p_api->write(g_uart0.p_ctrl, &modBus[0], qtd_B_MB);

 

//Clean buffer

for (im=0; im<64; im++)

     modBus[im] = 0x20;

/************************************************************/

 

My main question is if there is a way to ensure that first the command write is fully executed and then the program runs the rest of the code.

 

Regards,

 

Phillipe 


Viewing all articles
Browse latest Browse all 5781

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>