Crc Hserout Implementation


+ Reply to 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
    1,642

    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 ?
    This is more entertaining than Free to Air TV

  3. #3
    Join Date
    Feb 2018
    Posts
    5

    Default Re: Crc Hserout Implementation

    Hello Richard

    Thanks for reply, still dont tried something because my first step was confirm the behavior of conversion lookup against runtime data now reading youre explanation im 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, 17:11
  2. Crc
    By grich in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th May 2008, 09: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, 15:34
  4. LCDOUT Implementation
    By afbecker in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th March 2006, 15:48
  5. CAN Bus implementation
    By Christos_K in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th June 2005, 01:43

Posting Permissions

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