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

serial comm problem...

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



Joined: 16 Dec 2005
Posts: 22

View user's profile Send private message

serial comm problem...
PostPosted: Mon Jul 16, 2007 1:13 pm     Reply with quote

what's wrong?

Code:

#include <16F628A.h>
#fuses HS, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=20000000)
#use rs232(baud=115200, xmit=PIN_B2, rcv=PIN_B1)

#int_rda
void rda_isr(void) {

char temp;

   temp = getc();    // Get character from PC
   putc(temp);       // echo to PC
}   

//========================
void main() {
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);

while(1);
}


I get null for any data I send to the PIC... and interrupt would fire up only once.

Anybody? I've tried using UART but can't get it this time. Even using my old program. I've checked my hardware interface already (it's working). Everything should work fine.

Thanx Confused
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 16, 2007 1:30 pm     Reply with quote

I tested your program with a 16F628A on a PicDem2-Plus board,
with Hyperterminal Private Edition vs. 6.3, and it worked OK.
I was able to type characters in by hand, and the PIC echo'ed
them back to the terminal window correctly. I used PCM vs. 4.043
for this test. I used a 20 MHz crystal, the same as on your board.
Example of typing:
Quote:
asdfasdfasfdasfd now is the time for

First just type 'asdf', then type part of a sentence.
Guest








PostPosted: Mon Jul 16, 2007 4:24 pm     Reply with quote

Maybe try adding 'ERRORS' option to the use_rs232. It is supposed to reset the uart if an error in reception occurs. This could be caused if your receive pin is not in the idle state (high) between incoming bytes or before the first one that arrives. Without the ERROR option, the continuous receive enable (CREN flag in PIC) must be cycled to clear OERR (overrun error flag in PIC) or FERR (framing error flag in PIC) before reception can resume.
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