| поискавой системы для электроныых деталей |
|
MAX17843 датащи(PDF) 98 Page - Maxim Integrated Products |
|
|
|||||||||||||||||||||||||||||
MAX17843 датащи(HTML) 98 Page - Maxim Integrated Products |
|
98 / 131 page ![]() The host uses the algorithm to process all bytes received in the command packet prior to the PEC byte itself. Neither the PEC nor the alive-counter bytes are part of the calculation. The bits are processed in the order they are received, LSB first. A byte-wise pseudo-code algorithm is shown in Figure 71, but lookup table solutions are also possible to reduce host calculation time. For commonly issued command packets, the host can pre-calculate (hard-code) the PEC byte. For commonly used partial packets, the CRC value of a partial calcula- tion can be used as the initial value for a subsequent run-time calculation. Figure 71. PEC Calculation Pseudocode Function PEC_Calculation(ByteList(), NumberOfBytes, CRCByte) { // CRCByte is initialized to 0 for each ByteList in this implementation, where // ByteList contains all bytes of a single command. It is passed into the // function in case a partial ByteList calculation is needed. // Data is transmitted and calculated in LSb first format // Polynomial = x^8+x^6+x^3+x^2+1 POLY = &HB2 // 10110010b for LSb first //Loop once for each byte in the ByteList For ByteCounter = 0 to (NumberOfBytes – 1) ( //Bitwise XOR the current CRC value with the ByteList byte CRCByte = CRCByte XOR ByteList(Counter1) //Process each of the 8 CRCByte remainder bits For BitCounter = 1 To 8 ( // The LSb should be shifted toward the highest order polynomial // coefficient. This is a right shift for data stored LSb to the right // and POLY having high order coefficients stored to the right. // Determine if LSb = 1 prior to right shift If (CRCByte AND &H01) = 1 Then // When LSb = 1, right shift and XOR CRCByte value with 8 LSbs // of the polynomial coefficient constant. “/ 2” must be a true right // shift in the target CPU to avoid rounding problems. CRCByte = ((CRCByte / 2) XOR POLY) Else //When LSb = 0, right shift by 1 bit. “/ 2” must be a true right // shift in the target CPU to avoid rounding problems. CRCByte = (CRCByte / 2) End If //Truncate the CRC value to 8 bits if necessary CRCByte = CRCByte AND &HFF //Proceed to the next bit Next BitCounter ) //Operate on the next data byte in the ByteList Next ByteCounter ) // All calculations done; CRCByte value is the CRC byte for ByteList() and // the initial CRCByte value Return CRCByte } MAX17843 12-Channel, High-Voltage Smart Sensor Data-Acquisition Interface www.maximintegrated.com Maxim Integrated │ 98 |
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |