The Zhen Hua protocol is as follow:
19200 Buad, 1 start bit, 8 data bits, 1 stop bit
Synch bit: normally &hEF, but do vary between different types
Data sent as follow:
Channel 1 - Throttle
Channel 2 - Elevator
Channel 3 - Ailerons
Channel 4 - Rudder
All the bits are send in reverse order, so they have to be swapped to get the correct data. That is, bit 7 must become bit 0, bit 6 must become bit 1 etc...
Channel data will always be lower than synch byte.
Cenario 1
On some tx, the data is send in a continuous stream (Synch, Ch1, Ch2, Ch3, Ch4) with about 1.4ms spacing between bytes. 1.4ms delay between Ch4 and next Synck byte. In this case, there is enough time to transmit the decoded data between the received bytes of data.
Decoding:
Read the serial data using software routines
if synch byte found
transmit &hFF
else
swap bits around (channel data)
transmit data
endif
Cenario 2
There is also some that send Synch, Ch1, Ch2, Ch3, Ch4 with about 0.9ms between bytes, then followed by a delay to make up the normal 22ms between Ch4 and the next Synch byte. In this case, there is not enough time to transmit the decoded data between received bytes. One now needs to save the data, and transmit it after the 4th channel was read.
Decoding:
Read the serial data using software routines
if synch byte found
channel counter = 0
else
channel counter = channel counter +1
swap bits around (channel data)
save each channel data
if Channel counter = 4, transmitt &hFF, and 4 saved values
endif
As the output circuit and synch byte was found different between these transmitters, it makes it difficult to get the interface correct on the different types of tx. What might work for 1, might not work for another.
Hope this will help