 |
 |
| View previous topic :: View next topic |
| Author |
Message |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Wed Aug 22, 2007 5:58 am |
|
|
| Quote: |
I will finish the projetc with no RDA_isr()
|
Leaving an objective it is not the way to overcome it, nor to learn.
I also guess that the problem is related with your hardware.
Program your PIC with the code posted by PCM Programmer and with the help of a meter
pls. could you post the following voltages measured in your circuit.
GND as reference.
PIC_PIN14:
PIC-PINB1:
PIC-PIN4 (MCLR):
MAX232-PIN2:
MAX232-PIN6:
Humberto |
|
 |
saleh3
Joined: 28 Oct 2011 Posts: 1
|
|
Posted: Fri Oct 28, 2011 4:11 pm |
|
|
Use this
| Code: |
#define rx_buffer_size 16
char rx_buffer[rx_buffer_size];
#bit framingeError = getenv("BIT:FERR")
#bit overrunError = getenv("BIT:OERR")
char rx_index = 0;
#byte RCREG = getenv("SFR:RCREG")
#int_RDA
void RDA_isr(void)
{
char data;
data = RCREG;
if ((!framingeError) & (!overrunError)){
rx_buffer[rx_index++] = data;
}
if (rx_index >= 16) rx_index = 0;
} |
and
| Code: |
#use rs232(baud=9600,parity=E,xmit=PIN_C6,rcv=PIN_C7,bits=8,ERRORS)
|
don't forget errors.
When data has been transmitted to microcontroller, flag bit CRIF set to true and it will be cleared as soon as RCREG value has been read.
If you don't read RCREG's value in isr RCIF will remain set and produce interrupt and send your micro to infinite loop. |
|
 |
|
|
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
|