• Pic® Basic

  • OW_CRC

    A library module for use with Library Manager by JohnGB. This module has been written by Tim Box (Tim on PDS forum). The library module is offered on an as-is basis with no warranty as to its effectiveness, operation or reliability. Users use it at their own risk.

    Adds a new command called OW_CRC


    Var = OW_CRC DataArray, Length


    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.


    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.

    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
            HRSOut "CRC Error ", HEX2 CRCResult,10,13

    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
  • Recent Activity


    Mysterious PORTB problem

    Thread Starter: xldaedalus

    I'm using Proton+ to develop firmware for a product with switches. The MCU is an 18F26K22. Most of the switches reside on PORTB. I am NOT using a...

    See_Mos Yesterday, 10:05 Go to last post

    Pic16f18877 oread

    Thread Starter: evoortman

    Hi, On a PIC16F18877 the OREAD command doesn't seem to work. The code is working on a PIC16F1939. Both controllers use 32MHz int osc. If i...

    towlerg Yesterday, 13:23 Go to last post