Reimplementing UART on the PIC16F

Thread Starter

Robin66

Joined Jan 5, 2016
281
I tried adding a 1ms delay between each char. The received sequence had these removed. so I definitely think a pre-transmit processing stage in the HC12 is interferring with the bit sequence causing the receiver to not correctly recognise what's being sent
IMG_5780.JPG
 

Attachments

Thread Starter

Robin66

Joined Jan 5, 2016
281
Ok this is working now. I was focussed on getting the oscilloscope traces to match and had introduced a bug in my str matching logic in the Rx. The Rx now correctly receives the "Sam" transmission, even tho the HC12 trasmitter has modified the sequence.

Thanks for all the help guys. Very happy with this. Wish I'd taken @AlbertHall 's advice about switching to HC12 sooner, but I delayed because I had a particular good pair of cheap modules
 

hexreader

Joined Apr 16, 2011
619
Interesting - there seems to be no simple provision for 2 stop bits - never noticed that before, but then, I have never wanted 2 stop bits before.

So presumably you are sending, and expecting 1 stop bit.

Maybe it is the going to sleep that happens to give a similar delay to that of one bit? Just wildly guessing here.

If you are expecting 1 stop bit, then all is well, as long as everything works. An unwanted second stop bit is indistinguishable from a short gap between bytes as far as a receiver is concerned. The data rate may suffer a tiny bit, but this only matters in some circumstances.

Can't check for sure, since I do not have that particular PIC to test on.

Good that you have it all working though...
 

Thread Starter

Robin66

Joined Jan 5, 2016
281
The default power setting is the maximum '8' which is +20dBm. You can increase the range by reducing the baud setting to 2400.
You might care that the maximum legal power setting in the UK +10dBm - HC-12 level 4.
That's v helpful. Thank you. Since each module is a transceiver I shall have the units first transmit on the lowest setting and auto-increment power until they receive an ack from the hub. That will allow me to preserve batter life and minimise transmissions.

Btw, on the default setting the range is at least as far as the end of my road without dropping any packets.
 

AlbertHall

Joined Jun 4, 2014
12,625
That's v helpful. Thank you. Since each module is a transceiver I shall have the units first transmit on the lowest setting and auto-increment power until they receive an ack from the hub. That will allow me to preserve batter life and minimise transmissions.

Btw, on the default setting the range is at least as far as the end of my road without dropping any packets.
The receiver sensitivity is much better than the cheap modules.
 
Top