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

Software UART problem.

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








Software UART problem.
PostPosted: Thu Apr 10, 2008 9:30 am     Reply with quote

Software UART problem.

What can be the problem in this.

The TX is coming from a MAX232 and is working on the same chip with the Hardware uart.


Code:
#include <18F2455.h>

#FUSES NOXINST
#FUSES NOWDT
#FUSES INTHS             
#FUSES NOBROWNOUT
#FUSES PUT                     
#FUSES MCLR                   
#FUSES NOLVP

#use delay(CLOCK=4000000)
#use rs232(BAUD=19200,PARITY=N,XMIT=PIN_C6,RCV=PIN_C7,BITS=8,TIMEOUT=10,STREAM=com1,ERRORS)
#use rs232(BAUD=19200,PARITY=N,RCV=PIN_B1,BITS=8,TIMEOUT=10,STREAM=com2,ERRORS)


void Chk_com2(void){
 char c;
 if (kbhit(com2)){
  c=fgetc(com2);
  fputc(c,com1);
  fprintf(com1,"_%x_",c);
 }
}

//**Ext1 int**//
#INT_EXT1 //pin 22 int
void Ext_int1(void){
 Chk_com2();
}

void main(){
 
 ext_int_edge(1,H_TO_L);
 enable_interrupts(INT_EXT1);
 enable_interrupts(GLOBAL);
 
 
 while(1)
}
Matro
Guest







PostPosted: Thu Apr 10, 2008 10:42 am     Reply with quote

Try this
Code:

#use rs232(BAUD=19200,PARITY=N,RCV=PIN_B1,BITS=8,TIMEOUT=10,STREAM=com2,FORCE_SW,ERRORS)


Matro
Guest








PostPosted: Thu Apr 10, 2008 11:39 am     Reply with quote

The funny thing is, if I make a endless loop in main it's working.

Code:
void main{
while (1) {
 char c;
 c=fgetc(com2);
 fputc(c,com1);
 fprintf(com1,"_%x_",c);
}


I think the problem can be the handling of Ext1 int?

Any sugest...

F
Guest








PostPosted: Thu Apr 10, 2008 12:05 pm     Reply with quote

Solution in RS232 is the sw : SAMPLE_EARLY

Thanks
F
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