Datasheet

EA uniTFT Vorläufig
6
Delay in [10us] till EA uniTFT RS485-direction is altered. Default is 0 = immediately.
7
active: 0=ALLE, 1=RS232, 2=SPI, 3=I²C, 4=USB
8
mask: 1=break wait-command (#XXW), 2=actual macros, 4=Clear send buffer, 8=Clear receive buffer. The
individual bits can be OR-combined.
9
option: 1=Testmode, 2=Disable PowerOnMacro, 3=Disable defaults 4=Boot menu
CHECKSUM CALCULATION
In the following two sample functions, checksum calculation for Short or Small protocol, are shown.
SHORT PROTOCOLL
A cyclic redundancy check (CRC) is used to calculate the checksum. A common and well-known CRC test is the
CRC-CCITT. The initial value 0xFFFF is used. The following is a typical C-implementation. The functions must
be called externally. The checksum must be pre-assigned with the start value.
//---------------------------------------------------------------------------
-
//Function: buffer2crc16()
//input: ptr data, ptr to CRC, len
//output: ---
//Descr: CRC-CCITT of a buffer
//---------------------------------------------------------------------------
-
void buffer2crc16(UBYTE *dat, UINT16 *pCRC, UINT32 anz)
{
while(anz--)
crc16(*dat++, pCRC);
}
//---------------------------------------------------------------------------
-
//Function: sp_crc16()
//input: data, ptr to CRC
//output: ---
//Descr: CRC_CCITT (x^16+x^12+x^5+1 = 1 0001 0000 001>0 0001 = 0x1021
//---------------------------------------------------------------------------
-
void crc16 (UBYTE dat, volatile UINT16 * crc)
{
register UINT16 lcrc = *crc;
lcrc = (lcrc >> 8) | (lcrc << 8);
lcrc ^= dat;
lcrc ^= (lcrc & 0xFF) >> 4;
lcrc ^= lcrc << 12;
lcrc ^= (lcrc & 0xFF) << 5;
*crc = lcrc;
}
Technische Änderung vorbehalten.
Wir übernehmen keine Haftung für Druckfehler und Applikationsbeispiele..
Seite 43