Hi guys
I am having a problem with the RS232 I have made a small program which i have attached to send and receive Ascii it works fine in the simulation but will not work on the hardware. I have connected the TX out pin from one Pic to the RX in on the other (only sending in one direction) changed chips a few times but cannot get these boards to talk the clock speed on both is 19Mhz board rate 9600 the chips program correctly and display the correct data on the LCD displays except the Ascii code coming in can anyone help
Regards
Brian
RS232 fault PIC16F886B
Moderator: Benj
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
RS232 fault PIC16F886B
- Attachments
-
- View_Asci.fcf
- (9.5 KiB) Downloaded 239 times
-
- Send_Ascii.fcf
- (10.5 KiB) Downloaded 228 times
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: RS232 fault PIC16F886B
Hi Brian,
My guess is your missing the transmitted 232 chars.
It is unlikely that at the very point RS232 being 1st transmitted, the RX at at the receive rs232 macro component.
For that reason if I was you I would use rs232 in conjunction with rs232 receive interrupt.
Ben has an excellent example of using this interrupt for a circular buffer:
http://www.matrixmultimedia.com/mmforum ... 66&#p33484
At least with using an interrupt for rs232 receiving the transmitted rs232 should never be missed.
I would also check that transmitted rs232 is transmitted ok.
Have you got a UART to USB converter along with terminal software like Hyperterminal putty or tera term etc?
Then you can check PC can detect and display RS232 chars.
Martin
My guess is your missing the transmitted 232 chars.
It is unlikely that at the very point RS232 being 1st transmitted, the RX at at the receive rs232 macro component.
For that reason if I was you I would use rs232 in conjunction with rs232 receive interrupt.
Ben has an excellent example of using this interrupt for a circular buffer:
http://www.matrixmultimedia.com/mmforum ... 66&#p33484
At least with using an interrupt for rs232 receiving the transmitted rs232 should never be missed.
I would also check that transmitted rs232 is transmitted ok.
Have you got a UART to USB converter along with terminal software like Hyperterminal putty or tera term etc?
Then you can check PC can detect and display RS232 chars.
Martin
Martin
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Re: RS232 fault PIC16F886B
Hi Martin
Thanks I will check this out but unfortunately i do not have UART to USB converter and the software i think i must look unto getting this as i have been battling with this for weeks and cannot go forward to production.
Thanks I will check this out but unfortunately i do not have UART to USB converter and the software i think i must look unto getting this as i have been battling with this for weeks and cannot go forward to production.
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: RS232 fault PIC16F886B
Hi Brian,
Since I have already got UART to USB converter I will see if I can get this working over the weekend using RS232 interrupt.
I will post flowcharts when I have got tow PICs to communicate with each other.
Martin
Since I have already got UART to USB converter I will see if I can get this working over the weekend using RS232 interrupt.
I will post flowcharts when I have got tow PICs to communicate with each other.
Martin
Martin
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: RS232 fault PIC16F886B
Hi Brian,
I have got RS232 to successfully to work between two 16F690's
THere is nothing wrong with TX side.
I have just modified RX to work with RX interrupt.
The worrying thing is your View_Asci even works without modification (although its a tight loop, I recommend using interrupt).
So hardware is looking suspect?
Does LCD and a 1Hz flasher work OK.
Do you have Chip with Send_Ascii.fcf loaded pin 10 going to:
Chip with View_Asci pin12?
Can you scope the relevant TX and RX pins?
If not you can connect a LED (with current limiting resistor) to pin 10 of tx hardware and also remove from pin 10 and connect to pin 12 of the RX side. LED is acting like a voltage probe.
Martin
I have got RS232 to successfully to work between two 16F690's
THere is nothing wrong with TX side.
I have just modified RX to work with RX interrupt.
The worrying thing is your View_Asci even works without modification (although its a tight loop, I recommend using interrupt).
So hardware is looking suspect?
Does LCD and a 1Hz flasher work OK.
Do you have Chip with Send_Ascii.fcf loaded pin 10 going to:
Chip with View_Asci pin12?
Can you scope the relevant TX and RX pins?
If not you can connect a LED (with current limiting resistor) to pin 10 of tx hardware and also remove from pin 10 and connect to pin 12 of the RX side. LED is acting like a voltage probe.
Martin
- Attachments
-
- View_Asci V1.1.fcf
- (15.5 KiB) Downloaded 240 times
Martin
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: RS232 fault PIC16F886B
Hi Brian,
Glad you found the hardware fault.
Flowcode is not able to simulate RX interrupt.
However Real Pic Simulator (See http://www.matrixmultimedia.com/mmforum ... 01&#p24998 ) is able to detect RX interrupt.
When RS232 interrupt macros is accessed, the incoming RS232 Char is assigned to RXIN Variable.
Since the value of variable will be less than 255, the yes branch within Main is accessed, so the value of received char is sent to LCD.
Unless you mean more that one char at a time?
If so then the circular buffer I mentioned earlier will be able to receive more than one character at a time.
Martin
Glad you found the hardware fault.
Flowcode is not able to simulate RX interrupt.
However Real Pic Simulator (See http://www.matrixmultimedia.com/mmforum ... 01&#p24998 ) is able to detect RX interrupt.
The flowchart I posted above works by triggering RX interrupt when RX line goes from logic 1 to logic 0.jollybv wrote:how would you receive a string in RXINT.
When RS232 interrupt macros is accessed, the incoming RS232 Char is assigned to RXIN Variable.
Since the value of variable will be less than 255, the yes branch within Main is accessed, so the value of received char is sent to LCD.
Unless you mean more that one char at a time?
If so then the circular buffer I mentioned earlier will be able to receive more than one character at a time.
Martin
Martin