CRC25 - kuidas ?
#3
operandide tähendused leidsin ise ka aga ei funksi.
Minu kood:
Kood:
;===============================================================================
;#define X25_INIT_CRC 0xffff
;static inline void crc_init(uint16_t* crcAccum)
;{
;       *crcAccum = X25_INIT_CRC;
;}
;--------------------
;{
;       /*Accumulate one byte of data into the CRC*/
;       uint8_t tmp;
;
;       tmp=data ^ (uint8_t)(*crcAccum &0xff);
;       tmp^= (tmp<<4);
;       *crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
;}
; ---- Arvuta CRC -------
;       crc_init(&crcTmp);

;       for (i = 0; i < length; i++){
;               crc_accumulate(*pTmp++, &crcTmp);
;       }
;

;FE  09  4E  01  01  00  00  00  00  00  02  03  51  04  03  1C  7F
test:            movlw    0xFF        ; crc_init(&crcTmp)
                movwf    TBLPTRLt
                movwf    TBLPTRHt
                movlw    .10
                movwf    t_count
                LFSR    .0,0x25    ; puhver
;       tmp=data ^ (uint8_t)(*crcAccum &0xff);
;       tmp^= (tmp<<4);
;       *crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
tst1:            movf    POSTINC0,W        ; loe databait puhvrist -> W
                xorwf    TBLPTRLt,W         ; databait XOR CRC LOW -> t1_count (tmp=data ^ (uint8_t)(*crcAccum &0xff);)
                movwf    t1_count
                movwf    t2_count    
                bcf        CARRY            ; tmp^= (tmp<<4)
                rlcf    t1_count,F
                rlcf    t1_count,F
                rlcf    t1_count,F
                rlcf    t1_count,W        ; = tmp
                xorwf    t2_count,W
                movwf    t1_count
;*crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
                bcf        CARRY
                rrcf    TBLPTRHt,F
                rrcf    TBLPTRLt,F
                rrcf    TBLPTRHt,F
                rrcf    TBLPTRLt,F
                rrcf    TBLPTRHt,F
                rrcf    TBLPTRLt,F
                rrcf    TBLPTRHt,F
                rrcf    TBLPTRLt,F
                rrcf    TBLPTRHt,F
                rrcf    TBLPTRLt,F
                rrcf    TBLPTRHt,F
                rrcf    TBLPTRLt,F
                rrcf    TBLPTRHt,F
                rrcf    TBLPTRLt,F
                rrcf    TBLPTRHt,F
                rrcf    TBLPTRLt,F
                movff    t1_count,t2_count
                bcf        CARRY
                rlcf    t2_count,F
                rlcf    t2_count,F
                rlcf    t2_count,F
                rlcf    t2_count,F
                rlcf    t2_count,F
                rlcf    t2_count,F
                rlcf    t2_count,F
                rlcf    t2_count,W
                xorwf    TBLPTRLt,F                

                movff    t1_count,t2_count
                bcf        CARRY
                rlcf    t2_count,F
                rlcf    t2_count,F
                rlcf    t2_count,W
                xorwf    TBLPTRLt,F                

                movff    t1_count,t2_count
                bcf        CARRY
                rrcf    t2_count,F
                rrcf    t2_count,F
                rrcf    t2_count,F
                rrcf    t2_count,W
                xorwf    TBLPTRLt,F                

                decfsz    t_count
                goto    tst1
Mis on siin valesti ?
Vasta


Sõnumeid selles teemas
CRC25 - kuidas ? - Autor: felch - 26-01-2015, 10:52 PM
RE: CRC25 - kuidas ? - Autor: A.R. - 27-01-2015, 10:54 AM
RE: CRC25 - kuidas ? - Autor: felch - 27-01-2015, 05:04 PM
RE: CRC25 - kuidas ? - Autor: A.R. - 27-01-2015, 06:47 PM
RE: CRC25 - kuidas ? - Autor: A.R. - 28-01-2015, 05:09 PM
RE: CRC25 - kuidas ? - Autor: felch - 28-01-2015, 08:51 PM
RE: CRC25 - kuidas ? - Autor: felch - 28-01-2015, 11:09 PM
RE: CRC25 - kuidas ? - Autor: A.R. - 29-01-2015, 08:03 AM
RE: CRC25 - kuidas ? - Autor: felch - 29-01-2015, 08:42 AM
RE: CRC25 - kuidas ? - Autor: A.R. - 29-01-2015, 09:49 AM
RE: CRC25 - kuidas ? - Autor: felch - 29-01-2015, 11:38 AM
RE: CRC25 - kuidas ? - Autor: A.R. - 29-01-2015, 11:57 AM
RE: CRC25 - kuidas ? - Autor: A.R. - 29-01-2015, 07:00 PM
RE: CRC25 - kuidas ? - Autor: felch - 30-01-2015, 09:40 PM
RE: CRC25 - kuidas ? - Autor: madis - 30-01-2015, 11:46 PM
RE: CRC25 - kuidas ? - Autor: admin - 04-02-2015, 02:48 PM
RE: CRC25 - kuidas ? - Autor: A.R. - 04-02-2015, 05:28 PM
RE: CRC25 - kuidas ? - Autor: admin - 04-02-2015, 06:50 PM
RE: CRC25 - kuidas ? - Autor: A.R. - 04-02-2015, 08:50 PM
RE: CRC25 - kuidas ? - Autor: admin - 04-02-2015, 09:08 PM
RE: CRC25 - kuidas ? - Autor: felch - 04-02-2015, 11:36 PM
RE: CRC25 - kuidas ? - Autor: madis - 05-02-2015, 12:56 AM
RE: CRC25 - kuidas ? - Autor: A.R. - 05-02-2015, 08:35 AM
RE: CRC25 - kuidas ? - Autor: madis - 05-02-2015, 02:32 PM
RE: CRC25 - kuidas ? - Autor: felch - 05-02-2015, 05:17 PM

Alamfoorumi hüpe:


Kasutaja, kes vaatavad seda teemat: 1 külali(st)ne