• 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

    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
    Notes:

    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

    teo-16018

    Microsoft security essentials blues

    Thread Starter: shantanu@india

    Hi, A strange thing happened just now.My Windows 7 Micrsoft Sercurity Essentials suddenly gave a warning that prplus.exe(Compiler) is a potential...

    teo Today, 19:23 Go to last post
    pic-ignorant-1162

    Proton Runtime Error

    Thread Starter: Paulcc

    I have proton running well on my laptop, but after installing it on my desktop, I get the following runtime error: "Runtime Error 217 at 000709FC" I...

    pic-ignorant Yesterday, 22:11 Go to last post
    David Barker-251

    UMC bootloader 18F46K22

    Thread Starter: shunt010

    Hi all. I am trying to build a UMC bootloader file for the 18F46K22, and it doesn't appear to work. It returns (in the error log) Error ...

    David Barker Today, 11:20 Go to last post
    barak-1433

    SPI mssp

    Thread Starter: picprotonguy

    Just ordered Digital to Analog IC MCP4822 with SPI interface and immediately opened proton manual. I'm very disappointed, it looks like Proton...

    barak Today, 16:06 Go to last post