Page 1 of 1

RS232 fault PIC16F886B

Posted: Fri Jun 28, 2013 5:38 am
by jollybv
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

Re: RS232 fault PIC16F886B

Posted: Fri Jun 28, 2013 7:34 am
by medelec35
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

Re: RS232 fault PIC16F886B

Posted: Fri Jun 28, 2013 7:41 am
by jollybv
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.

Re: RS232 fault PIC16F886B

Posted: Fri Jun 28, 2013 5:54 pm
by medelec35
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

Re: RS232 fault PIC16F886B

Posted: Fri Jun 28, 2013 7:02 pm
by medelec35
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

Re: RS232 fault PIC16F886B

Posted: Sat Jun 29, 2013 1:27 pm
by jollybv
Hi Martin
Yip it was a board fault 2 Tracks were shorting it is now sorted and communicating Thanks for your Help.

Re: RS232 fault PIC16F886B

Posted: Mon Jul 01, 2013 6:02 pm
by jollybv
Hi Martin

I was just wondering can you simulate RXINT in V5 and how would you receive a string in RXINT.

Re: RS232 fault PIC16F886B

Posted: Mon Jul 01, 2013 6:36 pm
by medelec35
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.
Simulation.png
(98.08 KiB) Downloaded 2162 times
jollybv wrote:how would you receive a string in RXINT.
The flowchart I posted above works by triggering RX interrupt when RX line goes from logic 1 to logic 0.
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