Good day Henrik,
Many thanks for your swift reply and suggestion.
Regarding your indication to use HEX modifier all noted. However I am not sure what is the correct SYNTAX for it...
Mention that I am using PICBASIC PRO 2.60C & MCS 3.0.0.5 and below follows a fragment of code I try to implement:
////////////////////////////////////////////////////////////
i VAR BYTE
j VAR BYTE
new_data VAR BYTE[16] 'this array variable will store incoming data from serial port
Dummy VAR BYTE
test VAR BYTE[16] 'this array variable will store data READ from EEPROM
begin:
DEBUGIN 150, continue,[str new_data\16] 'receive data from PC
For i = 0 To 7 'read previously stored into EEPROM
READ $0+i,test[i]
Next i
'compare the income string data with one withdrawn from EEPROM and case they are different only then refresh the EEPROM
'this is done to avoid unnecessary time consuming writting / wasting the EEPROM
IF (new_data[0] <> test[0] AND new_data[1] <> test[1] AND new_data[2] <> test[2] AND new_data[3] <> test[3] AND new_data[4] <> test[4]_
AND new_data[5] <> test[5] AND new_data[6] <> test[6] AND new_data[7] <> test[7]) THEN
For j = 0 to 7
Dummy = (new_data[j<<1]<<4)|(new_data[(j<<1)+1] & $F) 'Mr. BigWumpus algorithm to split the data into 2 bits pairs
Write $0+j,Dummy 'write down into EEPROM the pairs consisting of 2 bits
next j
DEBUG "EEPROM data updated !"
ENDIF
continue: 'here follows some regular routines to execute case DEBUGIN timeframe (150 ms) is exceeded
////////////////////////////////////////////////////////////////
Kindly indicate the necessary corrections in order to have a functional code, in terms of suggested HEX modifier.
Also, I do believe that READ instruction need to be revised too in order to function as expected.
I really appreciate your help in this respect.
Many thanks in advance and have a nice day ahead and a Happy New Year !
Best regards,
Andrew
P.S. Kindly accept my apologies case this message appears posted twice. During first editing attempt my computer got stuck![]()





Bookmarks