CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

18f26j50 wait uart reception

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sebalitter



Joined: 05 May 2015
Posts: 41

View user's profile Send private message Send e-mail

18f26j50 wait uart reception
PostPosted: Sun Sep 04, 2016 12:15 pm     Reply with quote

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: 19329

View user's profile Send private message

PostPosted: Sun Sep 04, 2016 12:29 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group