The macro which reads rs-232 is set to interrupt 244 times a second to read 1 byte each pass
I put bytes 170,12,125,either in same file or using Vnet to send data and it never gets read in from rs232.
Can't figure out how to get reliable data at 9600 baud
I assume flowcode is storing more than the 2 bytes the buffer will hold (is this true?)
if so how many?
Any help greatly appreciated
TIA
Can't get RS232 to simulate or work in hardware
Moderator: Benj
-
- Posts: 33
- Joined: Mon Jul 23, 2012 7:17 pm
- Location: Petaluma california USA
- Has thanked: 26 times
- Been thanked: 2 times
- Contact:
Can't get RS232 to simulate or work in hardware
- Attachments
-
- RS232 OUT.fcf
- (9 KiB) Downloaded 280 times
-
- 18F43K22 16.32_92.fcf
- (67.61 KiB) Downloaded 247 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Can't get RS232 to simulate or work in hardware
Hi
You have had a problem in your RS232 receive macro. I have shown the right format of receiving macro in the snap-shot. you put variable in the nTime place but it should be in return data place. nTime could be 1 if you use interrupt for detecting RS232 reception but if the wire length is loo long you can wait up to 5 to maintain reliability. I have seen in my one project 5 is pretty enough for few meter distance with INT. BTW I have corrected code. Please let me know how it's behaving now.
You have had a problem in your RS232 receive macro. I have shown the right format of receiving macro in the snap-shot. you put variable in the nTime place but it should be in return data place. nTime could be 1 if you use interrupt for detecting RS232 reception but if the wire length is loo long you can wait up to 5 to maintain reliability. I have seen in my one project 5 is pretty enough for few meter distance with INT. BTW I have corrected code. Please let me know how it's behaving now.
- Attachments
-
- 18F43K22 16.32_92.fcf
- (67.62 KiB) Downloaded 262 times
-
- rs232.png
- (37.75 KiB) Downloaded 1938 times
-
- Posts: 33
- Joined: Mon Jul 23, 2012 7:17 pm
- Location: Petaluma california USA
- Has thanked: 26 times
- Been thanked: 2 times
- Contact:
Re: Can't get RS232 to simulate or work in hardware
not working yet
also changed interrupt to be slower but still no RS232 data being received into variables
also changed interrupt to be slower but still no RS232 data being received into variables
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Can't get RS232 to simulate or work in hardware
Hi
I would suggest you to make the receiving code simple for the time being to simply test different the RS232 transmission and reception. You can post simple Tx and Rx program. I will have a look if there are any issue still left.
I would suggest you to make the receiving code simple for the time being to simply test different the RS232 transmission and reception. You can post simple Tx and Rx program. I will have a look if there are any issue still left.
-
- Posts: 33
- Joined: Mon Jul 23, 2012 7:17 pm
- Location: Petaluma california USA
- Has thanked: 26 times
- Been thanked: 2 times
- Contact:
Re: Can't get RS232 to simulate or work in hardware
Ok now I got it to work with VNET and it simulates!
but doesn't work in hardware!
I had to put macro call in main loop instead of interrupt driven (takes forever to simulate with TMR0 divider set to 256)
But even when compiled same as simulation still no response from serial data.(From Hardware)


but doesn't work in hardware!
I had to put macro call in main loop instead of interrupt driven (takes forever to simulate with TMR0 divider set to 256)
But even when compiled same as simulation still no response from serial data.(From Hardware)
- Attachments
-
- PS2 SERIAL OUT.fcf
- (16.5 KiB) Downloaded 257 times
-
- 18F43K22 16.32_93.fcf
- (66.02 KiB) Downloaded 257 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Can't get RS232 to simulate or work in hardware
Hi
I have noticed couple of issues in the code. I will correct those and post asap. I haven't check your Rx code earlier in details...but checked just now. I have requested you to post simple Rx program not the whole code. It's not easy to debug where the problem is. I can't even find where you are calling RS232 macro( I mean I might have missed that in the long code). Please post a small example so that I can check that easily and you can then add the changed bit in your final code. I would suggest to RXINT for RS232 receive otherwise you will not get reliable behavior.
I have noticed couple of issues in the code. I will correct those and post asap. I haven't check your Rx code earlier in details...but checked just now. I have requested you to post simple Rx program not the whole code. It's not easy to debug where the problem is. I can't even find where you are calling RS232 macro( I mean I might have missed that in the long code). Please post a small example so that I can check that easily and you can then add the changed bit in your final code. I would suggest to RXINT for RS232 receive otherwise you will not get reliable behavior.