• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

635 to BS2p

cggbs

New member
I am trying to interface a serial Crystalfontz CFA-635 LCD to a BS2p. I believe I have the CRC probem handled, but the thing i am really having trouble with is the \ character. For example if i try to send out this:
Code:
SEROUT SO, Baud,[31,7,\000\001hello,$85,$05]
the stamp editor complains about the \ character.

31 = send data to lcd (row,col)
7 = data length
\000 = row address
\001 = col address
hello = text to display
$85,$05 = CRC

Does anyone have any ideas on how to send out this command properly?
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
USB LCD Displays - Graphic and Character LCDs with a Keypad

Joe

New member
Just Elliminate the "\" and leave the ",". Also you can have single 0's where you have 000. By the way, you said that you have the crc calculation handled? Do you have some code that I could see to calaculate the crc?
 

Joe

New member
Thanks for everybody's help and especially God's, I found the answer to CRC-16 code for the BS2 and PIC's. Here it is... Test it against this sites calculator CRC Calculator
Code:
CRC VAR Word 
Calc VAR Word 
aByte VAR Byte 
Counter VAR Nib 

POLYNOMIAL CON $8408

Main: 
CRC = $0000 
aByte = "1": GOSUB Calc_Crc 
aByte = "2": GOSUB Calc_Crc 
aByte = "3": GOSUB Calc_Crc 
aByte = "4": GOSUB Calc_Crc 
aByte = "5": GOSUB Calc_Crc 
aByte = "6": GOSUB Calc_Crc 
aByte = "7": GOSUB Calc_Crc 
aByte = "8": GOSUB Calc_Crc 
aByte = "9": GOSUB Calc_Crc 
DEBUG HEX crc 
END 

Calc_Crc: 
FOR Counter = 0 TO 7 
Calc = aByte ^ CRC & 1 
IF Calc = 0 THEN CRC_Add 
Calc = POLYNOMIAL 
CRC_Add: 
CRC = CRC / 2 ^ Calc 
aByte = aByte / 2 
NEXT 
RETURN
 
Top