View previous topic :: View next topic |
Author |
Message |
sebalitter
Joined: 05 May 2015 Posts: 47
|
18f26j50 wait uart reception |
Posted: Sun Sep 04, 2016 12:15 pm |
|
|
Hello,
this code is from other compiler, i want to change it to use ccs.
In pic18f26j50.
which is the equivalent to this line?
Code: | while(TXSTA.TRMT); //wait to send data |
Code: |
void USART_putsRN(char * data)
{
char c;
if(data == NULL)
return;
do
{
putc( *data );
while(TXSTA.TRMT); // espera a enviar el dato
delay_ms(10);
data++;
}while( *data != 0);
return;
}
|
|
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19730
|
|
Posted: Sun Sep 04, 2016 12:29 pm |
|
|
Just use puts.
Already there as a function. Sends a 'string', waiting for each character to send, and stopping when it reaches the 'null' terminator.
Exactly replaces the whole function, except for the 10mSec delays.
If you need to duplicate it:
Code: |
TRMT=getenv("BIT:TRMT")
//then wait with
while(TRMT)
; // wait for transmitter buffer empty bit
|
|
|
 |
|