AN370
Rev. 1.0
51
Outputs
:
pboEncodedBytes
: (pointer to BYTE in XDATA) Up to 8 valid encoded bytes in
output array.
Valid encoded array size
: (BYTE): Number of bytes in the output array pboEn-
codedBytes which are valid after encoding. Valid values are 1 through 8. Any
other return value will result in system instability.
One example for the custom encoding function might be the uncoded transmission using big endian rather than
little endian. The ODS shifts bits from a byte with b0 going to the PA first. If the user wants bit 7 to go first instead,
there are two options:
1. Bit flip all the data before transmission and set bEnc_NoneNrz_c no encoding.
2. Write a bit reverse function as a byte encoding custom function and use
bEnc_Custom_c
custom encoding.
The input data to the transmission chain will be unchanged and the bit flipping will happen just before the byte is
to be transmitted.
Users might find the latter approach more convenient.
7.4.5. Encoding Module Functions
vEnc_4b5bEncode
Description
: The function 4b5b encodes a byte into two bytes. Each byte contains the 5
bit encoded result of the corresponding nibble from the input byte. The bits are encoded in
the little endian fashion.
Prior to calling this function for the first time per transmitted frame the
vEnc_Set4b5bLastBit() must be called to set the initial value of the last bit that the 4b5b
encoding references. The last bit of the previous encoded value affects the encoding of the
next encoded value by inverting its bits when the last bit was a 1. The vEnc_4b5bEncode()
function updates the last bit.
That means that when using 4b5b encoding the user must call the vEnc_Set4b5bLastBit()
prior to calling the vStl_SingleTxLoop() every time.
Inputs
:
pboEncodedBytes: (pointer to xdata BYTE ) Pointer to the head of the 2 byte array
which will contain the resulting encoded bytes. The caller must declare this array.
biByteToEncode
: (BYTE) Byte to be encoded.
Outputs
:
pboEncodedBytes
: (pointer to BYTE in XDATA) Updated 2 byte array with
resulting encoded bytes.
Valid encoded array size
: (BYTE): Number of bytes in the output array pboEn-
codedBytes which are valid after conversion. In this case the value is 2.