|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
Software UART problem. |
Posted: Thu Apr 10, 2008 9:30 am |
|
|
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
|
|
Posted: Thu Apr 10, 2008 10:42 am |
|
|
Try this
Code: |
#use rs232(BAUD=19200,PARITY=N,RCV=PIN_B1,BITS=8,TIMEOUT=10,STREAM=com2,FORCE_SW,ERRORS)
|
Matro |
|
|
Guest
|
|
Posted: Thu Apr 10, 2008 11:39 am |
|
|
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
|
|
Posted: Thu Apr 10, 2008 12:05 pm |
|
|
Solution in RS232 is the sw : SAMPLE_EARLY
Thanks
F |
|
|
|
|
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
|