Picomite(VGA) V5.07.06 betas - flash drive support


Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5975
Posted: 06:41pm 20 Dec 2022      

Looks like the algorithm is solid. All tested outputs so far match exactly.

'MATH CRC evaluation

option base 1

'determine timer set/read time
timer=0
tr=timer

? tr*1000;" us"

'test string
a$="123456789"
l%=len(a$)

'convert test string to array (needed in V50706b5)
dim b%(l%)
for i=1 to l% : b%(i)=asc(mid$(a$,i,1)) : next i

'perform CRC validation
dim CRC%

'check CCITT CRC16
timer=0
CRC% = math (crc16 b%(),l%,,&hffff)
t=timer
? "CRC16-CCITT  ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)

'check MODBUS CRC16
timer=0
CRC% = math (crc16 b%(),l%,&h8005,&hffff,0,1,1)
t=timer
? "CRC16-MODBUS ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)

'check XMODEM CRC16
timer=0
CRC% = math (crc16 b%(),l%)
t=timer
? "CRC16-XMODEM ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)

'check MAXIM CRC8 (used in DALLAS signle wire devices)
timer=0
CRC% = math (crc8 b%(),l%,&h31,,,1,1)
t=timer
? "CRC8-MAXIM   ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)

'check standard CRC32
timer=0
CRC% = math (crc32 b%(),l%,,&hffffffff,&hffffffff,1,1)
t=timer
? "CRC32        ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)


And it really fast....

RUN
48 us
CRC16-CCITT   199 us, CRC = &h29B1
CRC16-MODBUS  208 us, CRC = &h4B37
CRC16-XMODEM  137 us, CRC = &h31C3
CRC8-MAXIM    224 us, CRC = &hA1
CRC32         259 us, CRC = &hCBF43926

Edited 2022-12-21 04:44 by Volhout