Adds a new command called OW_CRC
Syntax
Var = OW_CRC DataArray, Length
Overview
Returns the result of the Dallas One-Wire™ CRC calculation performed on the data set in DataArray. If the result is 0 the CRC is OK. A non-zero value indicates a CRC failure.
Operators
DataArray – A Valid label to the One-Wire™ Array on which the CRC Calculations will be executed
Length – A byte size variable defining the number of bytes within the array to be checked.
Code:
Dim TestData[8] As Byte
Dim CRCResult As Byte
' Load up Data array
TestData[0] = $05
TestData[1] = $C5
TestData[2] = $C3
TestData[3] = $08
TestData[4] = $00
TestData[5] = $00
TestData[6] = $00
TestData[7] = $CD 'CRC
CRCResult = OW_CRC TestData, 8
If CRCResult = 0 Then
HRSOut "CRC OK",10,13
Else
HRSOut "CRC Error ", HEX2 CRCResult,10,13
EndIf
The Array should be set to the maximum size message that you expect to have to handle from the One-Wire devices.
The length parameter should be the actual length of the message currently held in the array and should include the CRC value in the last byte.
Download module
Download: OW_CRC_Calcs

Menu
Recent Articles


Using PDS with SPI GLCD based on ST7565R Controller
Graphic LCDs based on the ST7565 are cheaper then GLCDs with other controllers. SPI requires only four pins. If the circuit