0
votes

I have a very low speed data connection over serial (RS485): 9600 baud actual data transmission rate is about 25% of that.

The serial line is going through an area of extremely high EMR. Peak fluctuations can reach 3000 KV.

I am not in the position (yet) to force a change in the physical medium, but could easily offer to put in a simple robust forward error correction scheme. The scheme needs to be easy to implement on a PIC18 series micro.

Ideas?

3
I develop with PIC18 devices and currently use both the MCC18 and the PICC18 compiler. I noticed a few weeks ago that the peripheral headers for PICC18 incorrectly map the Busy2USART() library macro to the TRMT bit instead of the TRMT2 bit. This caused me major headaches for short time before I discovered the problem. The simple code:Nate

3 Answers

1
votes

This site claims to implement Reed-Solomon on the PIC18. I've never used it myself, but perhaps it could be a helpful reference?

1
votes

Search for CRC algorithm used in MODBUS ASCII protocol.

0
votes

I develop with PIC18 devices and currently use the MCC18 and PICC18 compilers. I noticed a few weeks ago that the peripheral headers for PICC18 incorrectly map the Busy2USART() macro to the TRMT bit instead of the TRMT2 bit. This caused me major headaches for short time before I discovered the problem. Example, a simple transmission:

putc2USART(*p_value++);
while Busy2USART();
putc2USART(*p_value);

When the Busy2USART() macro was incorrectly mapped to the TRMT bit, I was never waiting for bytes to leave the shift register because I was monitoring the wrong bit. Before I realized the inaccurate header file, the only way I was able to successfully transmit a byte over 485 was to wait 1 ms between bytes. My baud rate was 91912 and the delays between bytes killed my throughput. I also suggest implementing a means of collision detection and checksums. Checksums are cheap, even on a PIC18. If you are able to listen to your own transmissions, do so, it will allow you to be aware of collisions that may result from duplicate addresses on the same loop and incorrect timings.