Crc Hserout Implementation


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2018
    Posts
    5

    Default Crc Hserout Implementation

    Hi To All

    i,m reading about crc on this thread http://www.picbasic.co.uk/forum/showthread.php?t=11790 and crc8 implementation for this code:
    Code:
    CRC      VAR BYTECRC_IDX  VAR BYTE
    CRC_IN   VAR BYTE
    CRC_Poly CON $31
    
    
    CRC8:
        FOR CRC_IDX = 0 to 7
            IF (CRC.7 ^ CRC_IN.7) THEN
                CRC = (CRC << 1) ^ CRC_Poly
            ELSE
                CRC = CRC << 1
            ENDIF
            CRC_IN = CRC_IN << 1
        NEXT CRC_IDX
    RETURN
    X      VAR BYTE
    
    
    CRC = 0
    FOR X = 0 TO 8
        LOOKUP X,[$AD, $42, $CB, $16, $05, $06, $00, $6C, $0E], CRC_IN
        HSEROUT [HEX2 CRC_IN," "]
        GOSUB CRC8
    NEXT X    
    HSEROUT ["= ",HEX2 CRC,13,10,13,10]
    
    
    CRC = 0
    FOR X = 0 TO 8
        LOOKUP X,[$AD, $42, $CC, $16, $05, $08, $00, $6C, $0C], CRC_IN 
        HSEROUT [HEX2 CRC_IN," "]
        GOSUB CRC8
    NEXT X    
    HSEROUT ["= ",HEX2 CRC,13,10,13,10]
    This Works with the values stored previously in lookup, however this could be implemented in a similar way for Hserin or Hserout in runtime ?, searching in the forum mostly of the examples involves data previously stored on program i,m building a vending machine that process information about rs232 and the data is changing constantly my project involves a 16f1938 microcontroller, i aprreciatte any advice about this issue.



    Best Regards


    Brainless

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383

    Default Re: Crc Hserout Implementation

    however this could be implemented in a similar way for Hserin or Hserout
    yes , the simplest way is store data to be sent or received data in a buffer before processing the crc of the buffered data

    what have you tried ?
    Warning I'm not a teacher

  3. #3
    Join Date
    Feb 2018
    Posts
    5

    Default Re: Crc Hserout Implementation

    Hello Richard

    Thanks for reply, still don´t tried something because my first step was confirm the behavior of conversion lookup against runtime data now reading you´re explanation i´m try to build the routine to store and process data and get the properly Crc value to the entire data at the end.


    Thanks Again

    Best Regards

    Brainless

Similar Threads

  1. Crc-16
    By Electrosolve in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th June 2013, 18:11
  2. Crc
    By grich in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th May 2008, 10:51
  3. MicroCode Studio 3.0.0.0 -> Implementation EasyPIC4
    By question in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 16:34
  4. LCDOUT Implementation
    By afbecker in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th March 2006, 16:48
  5. CAN Bus implementation
    By Christos_K in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th June 2005, 02:43

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts