Program is:
Atmega8; creating a custom Character with the LCDWriteChar command; script from the help file.
Compiled with the "new" stdbasic.h from oct 2014 I get the following errormessage during compiling:
makeHEX.bat
Great Cow BASIC (0.9 11/5/2014)
Compiling D:\GCB@Syn_Demos\test with LCDWriteChar.gcb ...
Done
Assembling program ...
An error has been found:
Error: GCASM: Symbol SYSCALCTEMPX has not been defined
The message has been logged to the file Errors.txt.
--------------------------------------------------------
Compiling with the "old" stdbasic.h from febr. 2014 no error messsage,
but no output on my 2-wire lcd (witch is using the new swap4 function).
Attached the program, the asm file compiled with the "new" stdbasic.h and
the asm file compiled with the "old" stdbasic.h
Kind regards,
Theo.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unless I am confused... how can a character be written to the LCD when the R/W (Read/Write) is tied to ground? I think you need to remove #define LCD_NO_RW.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On the other hand, I have verified that the SYSTEMCALCTEMPX variable is not being properly initialized (ATTiny13A) when using the LCD.h library. Using SYNWRITE 0.9 28/4/2014, so apologies if this has been fixed since then.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Theo. I do not think you can create custom characters with the two wire method. You need to be able to change the state of the R/W. If you do this then it may work.
By removing #define LCD_NO_RW and connecting the R/W on your chip to the R/W on the display may work - but, I have not tested or reviewed the code.
I can provide a one wire method that use serial. It is alternative route to using a limited number of connections.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't believe the R/W should matter when creating custom characters. Many years ago, I created custom characters on a 4x20 LCD so I could then create large digits. I did this for an article in my 2007 Nuts and Volts column "Getting Started with PICs". You only have 8 locations, 0-7, to load with the custom characters but the trick is you have to access the CGRAM area of the HD44780 chip. The R/W pin is grounded the whole time.
I re-posted the article at my website. It explains the concept so even though it was written for the Basic Atom, it should be easy to adapt it to GCB.
You can read more about it at my latest blog post with a link to the full article at:
Thanks Anobium, Chuck and Kent, I agree with Chuck that R/W is not necessary for the creation of custom characters; I only need the write to the LCD not to read.
With the example of the help file to send a custom character to the LCD I don't get any output at all on the LCD, so I created a new script with some commands to get something on the screen and indeed the LCDWriteChar command produces something, only not the expected result. Or I am writing to the wrong CGRAM address or the LCDWriteChar command reads from the wrong location or both?
There is something strange, either the LCDCreateChar as the LCDWriteChar command do something; but both command do there job not 100%.
New script:
#chip mega8,8#include<74LS164.h> ; include My IO 74LS164'UseLCDin2-wiremodewith74LS164/74HC164#define LCD_IO 2#define LCD_DB PORTC.0 ; databit#define LCD_CB PORTC.1 ; clockbit#define LCD_NO_RW'MyownIOsettings#define SWX PORTC.2 ; input pin from pushbuttons (A,B,C,D)#define Led PORTC.5 ; output pin for led#define SoundOut PORTC.0 ; output pin for toneDirSWXin;setportasinputforpushbuttonsDIMSYSCALCTEMPXASlongclspulseoutLed,10Ms;ifactive:programisrunninglcdcmd64LCD_RS=OnLCDBYTE=b'00000001'LCDNORMALWRITEBYTELCDBYTE=b'00000011'LCDNORMALWRITEBYTELCDBYTE=b'00000111'LCDNORMALWRITEBYTELCDBYTE=b'00001111'LCDNORMALWRITEBYTELCDBYTE=b'00011111'LCDNORMALWRITEBYTELCDBYTE=b'00111111'LCDNORMALWRITEBYTELCDBYTE=b'01111111'LCDNORMALWRITEBYTELCDBYTE=b'11111111'LCDNORMALWRITEBYTElcdcmd2LCDWriteChar0:Print" ":LCDWriteChar1:Print" ":LCDWriteChar2:Print" ":LCDWriteChar3locate1,0LCDWriteChar4:Print" ":LCDWriteChar5:Print" ":LCDWriteChar6:Print" ":LCDWriteChar7
It sounds like a timing issue.
Didn't the LCD source files get updated to a faster speed?
Could it be affecting this?
Isn't there a command to slow it down?
I can't find it in the online help file.
If you can find that, it may be worth a try.
Or just run at a slower oscillator.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Try slower speed etc. If this fails. Please post all code, the layout of your solution (a diagram of the component layout etc.) and I will duplicate. I am travelling at the moment so this will take a day or two to get on test. I will hook up a protocol analyser to try and figure out what is going on.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just tested gcBasic for the first time and i found the same bug.
I work on XPsp2...
I tested the Demo file "lcd light meter".
The original file was with a µC PIC16F877 , it is a 40 pins chip and this sample use the 8 bits mode on portD.
I compiled , it mahe it , OK.
Now i change the µc for a Pic16F876 (the same µc full compatible, but it have just 28 pins , and no PORTD)
The Data stay on PORTD just for test, I compiled ,it accepted the PORTD that is not exist on this µc
It is the first problem, not very important , i change the PORT it is OK.
Now I change the mode, for the 4 bits mode. And the great problem start...
The compiler say to me , there is an error , the same you had.
I search the LCD module that used by the compiler. (i think it is the define of the mode that added this module,...)
I found it in the repertory "C:\GCB@Syn\GreatCowBasicinclude\low level\" , the lcd.H header.
At the end i found some errors
the SysLCDTemp define was in the wrong way
SysLCDTemp define the output ou input not pin nunber that need 0 or 1
Now it compiled fine.
But I don't try it for the moment
I correct this part of LCD.H;
>#define SysLCDTemp LCD_DATA_PORT'Port to connect to LCD data bus. Used in 8-bit mode
>
>#define LCD_DB SysLCDTemp.0 'Data bit. Used in 2-bit mode
>#define LCD_CB SysLCDTemp.0 'Clock bit. Used in 2-bit mode
>
>#define LCD_DB4 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
>#define LCD_DB5 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
>#define LCD_DB6 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
>#define LCD_DB7 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
>
>#define LCD_RS SysLCDTemp.0 'Output bit to control LCD Register Select. Used as variable by 2-bit mode, and as a pin in 4 and 8 bit mode. DO NOT CHANGE FOR 2-BIT MODE.
>#define LCD_RW SysLCDTemp.0 'Output bit to select read/write
>#define LCD_Enable SysLCDTemp.0 'Output bit to enable/disable LCD
>
>#define LCD_RSTemp SysLCDTemp.0
Edited (by Anobium)
I hope the others demos will be better.
Last edit: Anobium 2014-11-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
define LCD_IO 4 'Number of pins used for LCD data bus (2, 4 or 8)
**This line select the mode 4 bits, you have to select it in your prog not in the .H
put it in comments...
define LCD_DB SysLCDTemp.0 'Data bit. Used in 2-bit mode
define LCD_CB SysLCDTemp.0 'Clock bit. Used in 2-bit mode
**OK
define LCD_DATA_PORT SysLCDTemp 'Port to connect to LCD data bus. Used in 8-bit mode
**this line is inverted LCD_DATA_PORT is defined in the prog and below we use SysLCDTemp .
You have 2 solution you change all the names below or you invert the 2 names
define LCD_DB4 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
define LCD_DB5 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
define LCD_DB6 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
define LCD_DB7 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
**OK
define LCD_RS SysLCDTemp.1 'Output bit to control LCD Register Select. Used as variable by 2-bit mode, and as a pin in 4 and 8 bit mode. DO NOT CHANGE FOR 2-BIT MODE.
**RS is an output put 0 not 1
define LCD_RW SysLCDTemp.0 'Output bit to select read/write
define LCD_Enable SysLCDTemp.0 'Output bit to enable/disable LCD
**OK
define LCD_RSTemp SysLCDTemp.2
**I don't know what is this RStemp, but RS is an output, then put 0 not 1 or 2 , and 2 is not a boolean may be the compiler take 1 bit if it is a boolean (2 deci = 10 bin) i don't know how the compiler convert the type ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To prove that custom characters are possible in 2-wire LCD mode (with Atmega8), run the following program.
The first part(step1 and 2)proves that the command LCDWriteChar is Ok, it shows 8 black fields for custom character 0 until 7(all bits are set)
The second part(after 5 seconds) shows that it is possible to create and use custom characters in 2 wire LCD mode. It also showes that the command LCDCreateChar is not working in 2-wire LCD mode.
(See my earlier comments)
Have a nice day.
#chip mega8,8#include<74LS164.h> ; include My IO 74LS164'UseLCDin2-wiremodewith74LS164/74HC164#define LCD_IO 2#define LCD_DB PORTC.0 ; databit#define LCD_CB PORTC.1 ; clockbit#define LCD_NO_RWDIMSYSCALCTEMPXASbyteLocate0,0Print"Step-1"'Drawthecustomcharacterlocate1,0forindex=0to7LCDWriteCharindex:print" "nextLocate0,0Print"Step-2"wait5S'CreateanarraytostorethecharacterDimAA(8)AA()=27,27,0,4,0,17,17,14clsLocate0,0Print"Step-3"lcdcmd64;gotocommandmode;characterloc0SetLCD_RSOnforindex=1to8LCD2_NIBBLEOUTSwap4(AA(index))'Swapbyte;MostsignificantNIBBLEsentfirstLCD2_NIBBLEOUTAA(index)'LessSignificantNIBBLEoutputnextlcdcmd128;gotodisplaymodeLocate0,0Print"Step-4"locate1,0LCDWriteChar0
Last edit: Theo 2014-11-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In conjuction with custom characters a weird thing happened;
I was figuring out how to create custom characters in 4-wire lcd mode(with atmega8), so i used the demo(LCDCreateChar) from the helpfile. Using the name for the array(TempArray) the displayed character was corrupted.
By using the name AA or anything else (not starting with temp)for the array, the displayed characters were 100%.
Maybe the help file should be changed or the compiler examined if variables starting with temp are causing problems.
Kind regards.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OOPS. My last post had an error; all the array elements need to be on the same line:
AA() = 0x00,0x0C,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x02,0x02,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x06,0x00,0x00,0x00,0x00,0x08,0x08,0x02,0x02,0x00,0x00,0x00,0x08,0x08,0x02,0x02,0x00,0x00,0x00
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Error during compiling.
Program is:
Atmega8; creating a custom Character with the LCDWriteChar command; script from the help file.
Compiled with the "new" stdbasic.h from oct 2014 I get the following errormessage during compiling:
makeHEX.bat
Great Cow BASIC (0.9 11/5/2014)
Compiling D:\GCB@Syn_Demos\test with LCDWriteChar.gcb ...
Done
Assembling program ...
An error has been found:
Error: GCASM: Symbol SYSCALCTEMPX has not been defined
The message has been logged to the file Errors.txt.
--------------------------------------------------------
Compiling with the "old" stdbasic.h from febr. 2014 no error messsage,
but no output on my 2-wire lcd (witch is using the new swap4 function).
Attached the program, the asm file compiled with the "new" stdbasic.h and
the asm file compiled with the "old" stdbasic.h
Kind regards,
Theo.
Program
asm with new stdbasic.h
asm with old stdbasic.h
I don't have the fix for you, but try this workaround and let us know.
Thanks for your help, kent_twt4.
After your workaround:
No error during compiling but no custom character on the screen.
I've adapted the original program but the program does not reach 'step2'.
Any help is welcome.
We had the same issue last week.
Unless I am confused... how can a character be written to the LCD when the R/W (Read/Write) is tied to ground? I think you need to remove #define LCD_NO_RW.
On the other hand, I have verified that the SYSTEMCALCTEMPX variable is not being properly initialized (ATTiny13A) when using the LCD.h library. Using SYNWRITE 0.9 28/4/2014, so apologies if this has been fixed since then.
@kent. We have an issue with SYSTEMCALCTEMPX. If you put a PRINT "" statement in the source file then this does initialise correctly.
We will look into the root cause. Meanwhile, I would declare DIM SYSCALCTEMPX AS LONG as a fix.
:-)
Thanks for your help, Anobium.
Your solutions is helpfull for the compiling of the program (no error message) but I don't get any custom character on my lcd screen.
@Theo. I do not think you can create custom characters with the two wire method. You need to be able to change the state of the R/W. If you do this then it may work.
By removing #define LCD_NO_RW and connecting the R/W on your chip to the R/W on the display may work - but, I have not tested or reviewed the code.
I can provide a one wire method that use serial. It is alternative route to using a limited number of connections.
I don't believe the R/W should matter when creating custom characters. Many years ago, I created custom characters on a 4x20 LCD so I could then create large digits. I did this for an article in my 2007 Nuts and Volts column "Getting Started with PICs". You only have 8 locations, 0-7, to load with the custom characters but the trick is you have to access the CGRAM area of the HD44780 chip. The R/W pin is grounded the whole time.
I re-posted the article at my website. It explains the concept so even though it was written for the Basic Atom, it should be easy to adapt it to GCB.
You can read more about it at my latest blog post with a link to the full article at:
http://www.elproducts.com
@Chuck. Thank you. I should have tested my thoughts first. :-)
@Theo - looks like a route to follow.
Thanks Anobium, Chuck and Kent, I agree with Chuck that R/W is not necessary for the creation of custom characters; I only need the write to the LCD not to read.
With the example of the help file to send a custom character to the LCD I don't get any output at all on the LCD, so I created a new script with some commands to get something on the screen and indeed the LCDWriteChar command produces something, only not the expected result. Or I am writing to the wrong CGRAM address or the LCDWriteChar command reads from the wrong location or both?
There is something strange, either the LCDCreateChar as the LCDWriteChar command do something; but both command do there job not 100%.
New script:
My problem is simular to
https://sourceforge.net/p/gcbasic/discussion/579126/thread/03721f5c/#31eb
Last edit: Theo 2014-10-29
It sounds like a timing issue.
Didn't the LCD source files get updated to a faster speed?
Could it be affecting this?
Isn't there a command to slow it down?
I can't find it in the online help file.
If you can find that, it may be worth a try.
Or just run at a slower oscillator.
Try slower speed etc. If this fails. Please post all code, the layout of your solution (a diagram of the component layout etc.) and I will duplicate. I am travelling at the moment so this will take a day or two to get on test. I will hook up a protocol analyser to try and figure out what is going on.
I just tested gcBasic for the first time and i found the same bug.
I work on XPsp2...
I tested the Demo file "lcd light meter".
The original file was with a µC PIC16F877 , it is a 40 pins chip and this sample use the 8 bits mode on portD.
I compiled , it mahe it , OK.
Now i change the µc for a Pic16F876 (the same µc full compatible, but it have just 28 pins , and no PORTD)
The Data stay on PORTD just for test, I compiled ,it accepted the PORTD that is not exist on this µc
It is the first problem, not very important , i change the PORT it is OK.
Now I change the mode, for the 4 bits mode. And the great problem start...
The compiler say to me , there is an error , the same you had.
I search the LCD module that used by the compiler. (i think it is the define of the mode that added this module,...)
I found it in the repertory "C:\GCB@Syn\GreatCowBasicinclude\low level\" , the lcd.H header.
At the end i found some errors
the SysLCDTemp define was in the wrong way
SysLCDTemp define the output ou input not pin nunber that need 0 or 1
Now it compiled fine.
But I don't try it for the moment
I correct this part of LCD.H;
Edited (by Anobium)
I hope the others demos will be better.
Last edit: Anobium 2014-11-03
@pat - What was the date of LCD.H? I need this information to resolve this issue in the source code.
the date in the old zip;
2007-01-15 20:59
the date in the last I have download (same thing)
2014-03-30 20:51
more explanations;
'I/O Ports
define LCD_IO 4 'Number of pins used for LCD data bus (2, 4 or 8)
**This line select the mode 4 bits, you have to select it in your prog not in the .H
put it in comments...
define LCD_DB SysLCDTemp.0 'Data bit. Used in 2-bit mode
define LCD_CB SysLCDTemp.0 'Clock bit. Used in 2-bit mode
**OK
define LCD_DATA_PORT SysLCDTemp 'Port to connect to LCD data bus. Used in 8-bit mode
**this line is inverted LCD_DATA_PORT is defined in the prog and below we use SysLCDTemp .
You have 2 solution you change all the names below or you invert the 2 names
define LCD_DB4 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
define LCD_DB5 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
define LCD_DB6 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
define LCD_DB7 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
**OK
define LCD_RS SysLCDTemp.1 'Output bit to control LCD Register Select. Used as variable by 2-bit mode, and as a pin in 4 and 8 bit mode. DO NOT CHANGE FOR 2-BIT MODE.
**RS is an output put 0 not 1
define LCD_RW SysLCDTemp.0 'Output bit to select read/write
define LCD_Enable SysLCDTemp.0 'Output bit to enable/disable LCD
**OK
define LCD_RSTemp SysLCDTemp.2
**I don't know what is this RStemp, but RS is an output, then put 0 not 1 or 2 , and 2 is not a boolean may be the compiler take 1 bit if it is a boolean (2 deci = 10 bin) i don't know how the compiler convert the type ...
@PAT. May I offer Skype or other alternative conf call to discuss? I am not understanding - please forgive me.
Any evening or weekend is good - let me know via a Personal Message.
hello
Do you receive my private mail?
yes..pop over to Skype. :-)
To prove that custom characters are possible in 2-wire LCD mode (with Atmega8), run the following program.
The first part(step1 and 2)proves that the command LCDWriteChar is Ok, it shows 8 black fields for custom character 0 until 7(all bits are set)
The second part(after 5 seconds) shows that it is possible to create and use custom characters in 2 wire LCD mode. It also showes that the command LCDCreateChar is not working in 2-wire LCD mode.
(See my earlier comments)
Have a nice day.
Last edit: Theo 2014-11-12
In conjuction with custom characters a weird thing happened;
I was figuring out how to create custom characters in 4-wire lcd mode(with atmega8), so i used the demo(LCDCreateChar) from the helpfile. Using the name for the array(TempArray) the displayed character was corrupted.
By using the name AA or anything else (not starting with temp)for the array, the displayed characters were 100%.
Maybe the help file should be changed or the compiler examined if variables starting with temp are causing problems.
Kind regards.
@Jack. Would you post the code as an attachment? I would like to use this an example in the Help File.
Is this ok?