PropBASIC-4x20 LCD in 4 bit mode
camelot2
Posts: 54
I'm searching for a PropBASIC program to run a 4x20 LCD in 4 bit mode
which has the HD44780 controller chip on board.
Any help in locating the code would be greatly appreciated - thanks
which has the HD44780 controller chip on board.
Any help in locating the code would be greatly appreciated - thanks
Comments
Is it possible to run PASM code with PropBASIC? Then the easiest solution might be to use a PASM driver. Mine (to be found in ObEx) has not much SPIN code - the code only copies HD44780 commands to the communication buffer of the PASM driver. Would be easy to write that function in BASIC and then add some comford functions.
Yes that is easy (to include PASM), PropBASIC has a ASM ... ENDASM construct for inlining PASM code.
I've had a quick glance into PropBASIC and for me it seems to be easily doable.
spent several hours looking over the 7 .spin files. The best I
can figure out is that the BenkyLCDdriver.spin is the file that
has to be inserted into my PropBASIC file using ASM and ENDASM.
This is where I am really lost that is how to convert all the
PUB sections and dat section. I know nothing about spin.
Any help in translating your code to PropBASIC would be greatly
appreciated - thanks again
It's far away from being a usefull piece of BASIC code, but it shows the first text on the LCD.
PS: To be honest I don't know how it works in detail, because I made my first experience with propBASIC ;o) So, currently I believe that the buffer used to communicate with the PASM-code is found by accident. Why can't PAR be passed to a task?
PPS: Check the PIN assignments.
PIN 5 is a LED in my setup which was used as a heartbeat in my first tests, to see that BASIC works as I expect it to work.
PIN15 is switching on the LCD backlight in my setup. Propably you don't need that!?
P8 = RS
P9 = R/W
P10 = E
P11..14 = D4..D7
Here is a new version of the BASIC-file. It now contains the subroutines
LCDClear
LCDChar
LCDString
LCDMove
LCDHex
Maybe you want to write LCDBin and LCDDec by yourself? You can have a look into BenkyLCDInterface.spin how I implemented these functions in SPIN.
first file I will now try the 2nd.
I'll give it my best shot trying to write the LCDBin and LCDDec but no
guarantees
1. I am trying to print "01234567890123456789" to line 3 or
line 4 but it is being displayed on two lines and broken
up. I can not find in the file where you change to a 4
line display. Works fine on line 1 or 2. Any clues??
2. still trying to convert the LCDBin and LCDDec with zero
results
thanks again for all your help
$00 for line 1
$40 for line 2
that's why the basic code has the line
__param1 = __param1 << 6
For a 4 line display it's
$00 for line 1
$40 for line 2
$14 for line 3
$54 for line 4
as a workaround you can simply add $14 to the x coordinate in case you want to use line 3 (y set to 1) and 4 (y set to 2).
I'll be back at home this evening and then I can change the basic-code. Then I can also take care of the LCDBin and LCDDec.
Important is to set the constant STG_LINE_WIDTH according to your display. LCDMove now expects row and column number to start from 0. (Before they started from 1.)
Have fun!
MyFirst.pbas