Dim xxSTR as string
xx = -17
xxSTR = strinteger(xx)
GLCDPrint(10, 10, xxSTR, TFT_YELLOW) ;prints out 65519 NOT -17 WHY?
glcddrawstring ( 20, 20, xxSTR)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using this GLCD https://www.adafruit.com/product/1770
I wrote this simple program to print out a negative number on my LCD and GLCD.
'****
Why does the LCD correctly print -17 but the GLCD incorrectly print 65519?
It appears to be something with twos complement in reverse as the twos complement 0f 65519 is -17.
This happens with other negative numbers, too. Positive numbers print correctly.
What happens when you use glcddrawstring ( 10, 10, str(xx)) or
glcdprint (10, 10, str(xx))
Last edit: Anobium 2019-02-27
I think the Help needed an update. See https://github.com/Anobium/Great-Cow-BASIC-Help/blob/master/source/glcdprint.adoc
Using glcddrawstring ( 10, 10, str(xx)) or glcdprint (10, 10, str(xx)) gives the same results 65519.
Why STR? I'm trying to print an integer
I tried some more. This works:
Stupid me.... you are correct. strinteger
What happens when you use glcddrawstring ( 10, 10, strinteger(xx)) or
glcdprint (10, 10, strinteger(xx))
I will update the Help now. Please confirm this works.
To answer why use strinteger. GLCDPrint only support byte, word, long or string.
If you think is it critical to add the integer type to GLCDPrint then it is relatively simple ( I think).
Add? You will have to test.
Its not critical for me.
Thanks for your help!
OK. I have updated the Help. That was less work.
CHEERS