Hola amigos, estoy de los pelos con una comunicacion rs232 entre dos pics 16F628A.
En la placa tengo estos dos micros, el tx del master con el rx del esclavo y viceversa.
Envío datos del master al esclavo y este ni siquiera entra en la interrupcion RDA,puse para q encienda un led cuando recibe cualquier dato y no lo hace... Mas abajo pego el codigo....
Lo raro es que por software (FORCE_SW) funciona perfecto..
MASTER:
#include <16F628A.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES BROWNOUT //Reset when brownout detected
#FUSES MCLR //Master Clear pin enabled
#FUSES NOLVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD //No EE protection
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,XMIT=PIN_B0,BITS=8,FORCE_SW)
#use fast_io(A)
#use fast_io(B)
void main()
{
setup_oscillator(OSC_4MHZ);
setup_comparator(NC_NC_NC_NC);
set_tris_b (11111110);
set_tris_a (11111001);
while(1){
printf ( "1A" );
delay_ms ( 30 );
printf ( "1B" );
delay_ms ( 30 );
}
}
SLAVE:
#include <16F628A.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES BROWNOUT //Reset when brownout detected
#FUSES MCLR //Master Clear pin enabled
#FUSES NOLVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD //No EE protection
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,RCV=PIN_B1,BITS=8)
#use fast_io(A)
#use fast_io(B)
#define ledb PIN_A1
#int_RDA
RDA_isr() {
output_toggle(ledb);
}
void main()
{
setup_oscillator(OSC_4MHZ);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
set_tris_b (11111111);
set_tris_a (11111000);
while(1){
}
A alguien se le ocurre por que puede ser que no entre en interrupcion??
poniendo en el escalvo FORCE_SW, y poniendo getc() en el main, funciona perfecto.... ?¿?¿?¿?¿
SALUDOS!!!!