RS232 problem on 18F2520
Hello, My friend and I are starting a little project on 16F88, with switch after on 16F877A and now we want to use the 18F2520 but some feature of RS232 exchange won't working.
The facts are: We developped a simple flashing Led and RX/TX RS232 code connected to a PC (HyperTerminal). The Led always flashing and a basic loop send is incremental counter on RS232 TX (RC6). The computer receive the loop increment and all working great until the RX pin was activated (RC7->Pin#18). When we trying to send a data from PC to PIC, the Led stop flashing and microcontrolleur seem to reset, after a while, the program look to been restart and the computer display goes on with low increment number (like a begining routine) and Led start flash again. The RX (RC7) seem to act as reset pin ?
We try some configuration (C module), the last one was:
osccon = 0x70;
trisb = (0x00); // PortB are outputs
trisa = (0x80); // bit7 input bit6-0 are outputs
trisc = (0x00);
latb=(0xff);
lata=(0xff);
latc=(0xff);
clear_bit(sspcon1, 5);//0 = Disables serial port and configures these pins as I/O port pins
clear_bit(baudcon, 1);//WUE
clear_bit(baudcon, 0);//ABDEN
set_bit(rcon, 7);//IPEN
set_bit(intcon, 7);//GIE GIEH
set_bit(intcon, 6);//PEIE GIEL
set_bit(pie1, 5);//RCIE
Can anybody help us ? Thanks.
RS232 problem on 18F2520
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 problem on 18F2520
Hello,
What are you using to convert the RS232 voltage levels from 12V to TTL 5v? Are you using an E-block or your own hardware to do this? Was the 16F877 working ok with the same hardware? Are you servicing the RXINT interrupt and manually clearing the RXIF interrupt flag? Could be the program is getting stuck here.
What are you using to convert the RS232 voltage levels from 12V to TTL 5v? Are you using an E-block or your own hardware to do this? Was the 16F877 working ok with the same hardware? Are you servicing the RXINT interrupt and manually clearing the RXIF interrupt flag? Could be the program is getting stuck here.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel