I was trying to make a character set for my LCD as it doesn't have character functions built in.
I needed to get the ascii value of a single character but couldn't find a built in function to do that. Well looking through the GLCD code I found this
~~~~~~~~~~~~~~
Sub GLCDPrint(In PrintLocX, In PrintLocY, PrintData As String)
PrintLen = PrintData(0)
If PrintLen = 0 Then Exit Sub
GLCDPrintLoc = PrintLocX
'''Draws a character at the specified location
'''@hide
Sub GLCDDrawChar(In CharLocX, In CharLocY, In CharCode)
~~~~~~~~~~~~~
PrintData is a string going into GLCDPrint but is sent as PrintData(SysPrintTemp) (one element of the string). But GLCDDrawChar takes it as an integer thus changing it from a string to an ascii value.
Neat trick! I'm not sure if it is soft error checking or automatic conversion by the complier but it works!
Last edit: Randy 2014-01-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was trying to make a character set for my LCD as it doesn't have character functions built in.
I needed to get the ascii value of a single character but couldn't find a built in function to do that. Well looking through the GLCD code I found this
~~~~~~~~~~~~~~
Sub GLCDPrint(In PrintLocX, In PrintLocY, PrintData As String)
PrintLen = PrintData(0)
If PrintLen = 0 Then Exit Sub
GLCDPrintLoc = PrintLocX
End Sub
'''Draws a character at the specified location
'''@hide
Sub GLCDDrawChar(In CharLocX, In CharLocY, In CharCode)
~~~~~~~~~~~~~
PrintData is a string going into GLCDPrint but is sent as PrintData(SysPrintTemp) (one element of the string). But GLCDDrawChar takes it as an integer thus changing it from a string to an ascii value.
Neat trick! I'm not sure if it is soft error checking or automatic conversion by the complier but it works!
Last edit: Randy 2014-01-07