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 CCS Technical Support

usart 16F877A

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



Joined: 23 Feb 2008
Posts: 29

View user's profile Send private message

usart 16F877A
PostPosted: Sun Apr 19, 2009 3:46 pm     Reply with quote

Hi!

I am using a PIC16F877A, as possible checking RCIF? as you are reading RCREG?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Apr 19, 2009 3:54 pm     Reply with quote

Make a test file. Set the List file format for "Symbolic". Compile the
file and look at the .LST file to see the generated ASM code.

Look at the .LST file below. The kbhit function tests the RCIF bit. The
getc() function also tests the RCIF bit (in a loop) and if it is True, then it
reads the RCREG register.
Code:

... if(kbhit())
0015:  BCF    STATUS.RP0
0016:  BTFSS  PIR1.RCIF   // Test the RCIF bit
0017:  GOTO   01C

.... c = getc();
0018:  BTFSS  PIR1.RCIF
0019:  GOTO   018      // Stay in a loop until RCIF == 1
001A:  MOVF   RCREG,W  // Then read RCREG
001B:  MOVWF  c


Here is the test program:
Code:
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

//================================
void main()
{
int8 c;
int8 status;

if(kbhit())
   c = getc();

while(1);
}
volcane



Joined: 23 Feb 2008
Posts: 29

View user's profile Send private message

PostPosted: Sun Apr 19, 2009 4:07 pm     Reply with quote

Hi!

thanks

without you i do not know how to do :-)
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