When I write:
locate 0, 0 or locate 1, 0 it prints at the correct location.
When I write :
locate 2, 0 or locate 3, 0 it incorrectly prints at location 2, 4 or 3, 4, respectively.
I'm using 16x 4 displays. One uses the HD44780 chip and the others uses a chip with a paper label over it with UC-16401 on it. I pealed the label off but still couldn't read the number.
I tried this with an 18F4550 but got the same results.
When I used an old 20x4 LCD it worked correctly with both PICs.
Any ideas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On a more serious note.... Try increasing the delays. This does sound like a timing issue on a specifically slow LCD. These are the parameters I can see. Try settle these to very high value.. maybe 255 then if this fixes the issue bring them down.
Set these in the user program.
#define LCD_Write_Delay 2 us ' now change all delays
#define slow_us 80
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sub LOCATE (In LCDLine, In LCDColumn)
Set LCD_RS Off
If LCDLine > 1 Then
LCDLine = LCDLine - 2
LCDColumn = LCDColumn + 20
End If
LCDWriteByte(0x80 or 0x40 * LCDLine + LCDColumn)
wait 5 10us 'test
End Sub
In the line that reads : LCDColumn = LCDColumn + 20 If I change the "20" to "16"
LCDColumn = LCDColumn + 16
It now works correctly. Is this because I'm using 16x4 display? If so is there some code I can add to my program to over ride the "20"?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using version 98.01 with an 18F452 and #define LCD_IO 2 which uses a 74LS174 shift register and the circuit shown at this link:
http://gcbasic.sourceforge.net/library/DIAGRAMS/2-Wire%20LCD/2-wire%20LCD%2074LS174%20(LCD_IO%202_74xx174%20-%20pre%20Aug2015).JPG
When I write:
locate 0, 0 or locate 1, 0 it prints at the correct location.
When I write :
locate 2, 0 or locate 3, 0 it incorrectly prints at location 2, 4 or 3, 4, respectively.
I'm using 16x 4 displays. One uses the HD44780 chip and the others uses a chip with a paper label over it with UC-16401 on it. I pealed the label off but still couldn't read the number.
I tried this with an 18F4550 but got the same results.
When I used an old 20x4 LCD it worked correctly with both PICs.
Any ideas?
Slow down the transmission.
Specfic LCD may need slower communications.
I tried #DEFINE LCD_SPEED SLOW but it didn't help.
Any other ideas?
Ummm. Let me check the issue with you.
So, same source code? Same version of Great Cow BASIC. Correct? but, this specific device does not work as expected.
Yes, all the same. This LCD does not work as expected.
Tried hitting it?
On a more serious note.... Try increasing the delays. This does sound like a timing issue on a specifically slow LCD. These are the parameters I can see. Try settle these to very high value.. maybe 255 then if this fixes the issue bring them down.
Set these in the user program.
I tried the above suggestion and got the same results. I tried different delay times up to 255 but got the same results.
I also tried in #define LCD_IO 8 mode but still the same results.
In the lcd.h include file is the following SUB:
In the line that reads : LCDColumn = LCDColumn + 20 If I change the "20" to "16"
LCDColumn = LCDColumn + 16
It now works correctly. Is this because I'm using 16x4 display? If so is there some code I can add to my program to over ride the "20"?
You are correct!
Try the attached.
Add the following to your program.
#define lcd_width 16
Thanks! It works now.
I will document and promote to release.
All sorted.
https://github.com/Anobium/Great-Cow-BASIC-Help/blob/master/source/lcd_width.adoc