Nothing on LCD: I2CWRITE SDA, SCL,com,$40, x
In ST7036 manual I not found how I can display a decimal number.
Printable View
Nothing on LCD: I2CWRITE SDA, SCL,com,$40, x
In ST7036 manual I not found how I can display a decimal number.
looks like incorrect syntax , should be like thisQuote:
I2CWRITE SDA, SCL,com,$40,"hello"
to display x (assume pbp3)Code:I2CWRITE SDA, SCL,com,[$40,"hello"]
[/CODE]Code:buff var byte[16]
ARRAYWRITE buff,[dec3 x]
I2CWRITE SDA, SCL,com,[$40,str buff"]
Now that I think about it you probably will need to include a "Modifer" before your variable.
Otherwise your LCD display may think the number is some sort of control character or it may be a non displayable character.
from the PBP manual...
Quote:
An assortment of string-formatting modifiers is available for use within the item list
of this command. These modifiers can be used to format string output that includes
numeric values converted from variables:
Output Modifiers for Formatting Strings
Modifier Operation
{I}{S}DEC{1..10} Send decimal digits
{I}{S}BIN{1..32} Send binary digits
{I}{S}HEX{1..8} Send hexadecimal digits
REP char\count Send character c repeated n
times
STR ArrayVar{\count} Send string of n characters
See section 2.11 for details on string-formatting modifiers.
Now display the x value on LCD , like "hello 012" .
In main loop, the text is scrolling from right to left on 2 lines.
Thank you very much for your help!Code:SCL VAR PORTC.0
SDA var PORTC.1
Reset var PORTC.2
x var byte :x=12
com con $78
buff var byte[16]
pause 100
HIGH Reset
goto StartProgram
'********************************************************************************
'=============Initializing LCD==========
ST7036Init:
I2CWRITE SDA,SCL,com,[$00,$38]'function set
pause 1
I2CWRITE SDA,SCL,com,[$00,$39]'function set
pause 1
I2CWRITE SDA,SCL,com,[$00,$14]'internal OSC
pause 1
I2CWRITE SDA,SCL,com,[$00,$6A]'follower control
pause 1
I2CWRITE SDA,SCL,com,[$00,$0C]'display on/off
pause 1
here:
I2CWRITE SDA,SCL,com,[$00,$01]'clear display
pause 1
I2CWRITE SDA,SCL,com,[$00,$06]'entry mode set
pause 1
Return
'********************************************************************************
startProgram:
ARRAYWRITE buff,[dec3 x]
gosub ST7036Init
I2CWRITE SDA, SCL,com,[$40,"hello ",str buff\x]
Main:
'I2CWRITE SDA, SCL,com,[$40,"hello ",str buff\x]
pause 1000
goto Main
is incorrectQuote:
I2CWRITE SDA, SCL,com,[$40,"hello ",str buff\x]
orQuote:
I2CWRITE SDA, SCL,com,[$40,"hello ",str buff]
is whats required.Quote:
I2CWRITE SDA, SCL,com,[$40,"hello ",str buff\3 ]
The "\x" ( length specifier) if used is the number or chr's in the the string {buff in this case } to send (12 {the value of x} is inappropriate), a null terminated string (as created by arraywrite ) needs no length parameter to be specified if you wish to send the entire string
Now I understand arrays variable. Thank you for your patience and explanation!
Hi,
I am just curious. Did you manage to run LCD with the pinout from MIDAS? I mean the pinout you mentioned at beginning of this thread.