InowuseGCB@SYNalmostexclusively,butwhenIcompileaprogrambyThomasHenry(Two-Line-LCD.gcb,postedbelow),Igetanerror.First,theprogram:;Two-LineSerialDriverandDemonstrationofLCDFeatures;forthePIC12F683(GreatCowBasicsource).;ThisRevision:6/2/2013;ThomasHenry;Note:a2by16LCDisassumed.;-----Configuration#chip 12F683,8 ;PIC12F683 running at 8 MHz#config mclr=off ;reset handled internally#config osc=int ;use internal clock;-----EepromData;Thefollowingmessagesneedtobeburned;intoeepromdata.Copyandpastethisblock;attheendoftheassemblerfile,removing;thesemicolons,ofcourse.Thenassemble;thatfileasusualtocreatethehexfile.'ORG 0x2100'DE "First well show"'DE "this message. "'DE "Then well blink"'DE "five times. "'DE "Now lets pan "'DE "left and right. "'DE "Watch the line "'DE "cursor move. "'DE "A block cursor "'DE "is available. "'DE "Next well scroll this long message as a continuous marquee in one line mode. "'DE "Characters: Bye!"'END;-----Constants#define ser GPIO.0 ;shift register data on GP0, pin 7#define clk GPIO.1 ;shift register clock on GP1, pin 6;HerearevariousLCDcommandswhichcanbeused.;ThesearetheLCDcommandsfortheHD44780controller#define clrHome = 1 ;clear the display, home the cursor#define home = 2 ;home the cursor only#define RtoL = 4 ;print characters right to left#define insR = 5 ;insert characters to right#define LtoR = 6 ;print characters left to right#define insL = 7 ;insert characters to left#define lcdOff = 8 ;LCD screen off#define lcdOn = 12 ;LCD screen on, no cursor#define curOff = 12 ;an alias for the above#define block = 13 ;LCD screen on, block cursor#define under = 14 ;LCD screen on, underline cursor#define undblk = 15 ;LCD screen on, blinking and underline cursor#define CLeft = 16 ;cursor left#define CRight = 20 ;cursor right#define panR = 24 ;pan viewing window right#define panL = 28 ;pan viewing window left#define bus4 = 32 ;4-bit data bus mode#define bus8 = 48 ;8-bit data bus mode#define mode1 = 32 ;one-line mode (alias)#define mode2 = 40 ;two-line mode#define line1 = 128 ;go to start of line 1#define line2 = 192 ;go to start of line 2;-----Variablesdimchar,msn,lsn,index,iasbyte;-----MainProgramdirGPIO0b00000000;alloutput(onlyGP0andGP1used)init;initializetheLCDdisplayprintMsg(0);printfirstmessagewait3S;pause3secondsprintMsg(2);printnextmessagewait3S;pause3secondsrepeat5;blinkitfivetimessendCmd(lcdOff);displayoffwait500mS;pausesendCmd(lcdOn);displayonwait500mS;pauseendrepeatwait1S;pausebeforenextdemo;demonstratepanningprintMsg(4);printnextmessagewait3S;pause3secondsrepeat16sendCmd(panL);panleftastepatatimewait300mS;slowdowntoavoidblurendrepeatrepeat16sendCmd(panR);thenpanrightwait300mSendrepeatwait1S;pausebeforenextdemo;demonstratemovingthecursorprintMsg(6);printnextmessagewait3S;pause3secondsdoHome;homecursorsendCmd(under);chooseunderlinecursorfori=0to15;movecursoracrossfirstlinesendCmd(line1+i)wait200mSnextifori=0to15;movecursoracrosssecondlinesendCmd(line2+i)wait200mSnextifori=15to0step-1;movecursorbackoversecondlinesendCmd(line2+i)wait200mSnextifori=15to0step-1;movecursorbackoverfirstlinesendCmd(line1+i)wait200mSnextiwait3S;demonstrateblinkingblockcursorprintMsg(8);printnextmessagedoHome;homethecursorsendCmd(block);chooseblinkingblockcursorwait4S;pause4secondssendCmd(mode1);changetoonelonglinemodedoHome;homethecursoragainsendCmd(curOff);anddisableit;demonstratescrollingalengthyone-linemarqueefori=160to237;printnextmessageEPreadi,char;fetchdirectlyfromeepromsendChr(char)nextiwait1SdoHome;homecursoroncemorerepeat141;scrollmessagetwicesendCmd(panR)wait500mSendrepeatwait2SsendCmd(mode2);changebacktotwolinemodedoClr;clearthescreen;demonstrateallofthecharactersfori=238to250;printnextmessageEPreadi,charsendChr(char)nextifori=33to127;printfirstbatchofASCIIcharacterssendCmd(line1+12);overwriteeachcharacterdisplayedsendChr(i);thisistheASCIIcodewait500mSnextifori=161to255;printnextbatchofASCIIcharacterssendCmd(line1+12)sendChr(i)wait500mSnexti;saygood-byesendCmd(line2)fori=250to253;printlastmessageEPreadi,charsendChr(char)nexti;-----InitializetheLCDonpower-uporresetsubinitwait200mS;lettheLCDsettlefor200mSecsendNib(bus8/16);beginin8-bitmodewait5mSsendNib(bus8/16);sendagainwait100uSsendNib(bus8/16);andoncemorewait100uSsendNib(bus4/16);switchto4-bitmodewait100uSsendCmd(mode2);2-linemodeandLCDoffwait100uSdoClr;clearthescreensendCmd(LtoR);printlefttorightwait100uSsendCmd(lcdOn);turndisplayon,nocursorwait100uSendsub;-----SendaNibbletotheLCDsubsendNib(inparamasbyte)param=param|0b01000000;settheEnablebitrepeat8rotateparamleft;shiftbitsinoneatatimeser=status.c;putthebitonserialinputpulseOutclk,2uS;clockitinendrepeatwait5uS;waitforEnabletotakeeffectpulseOutclk,2uS;cleartheshiftregisterpulseOutclk,2uS;andtheoutputlatchesendsub;-----SendaCommandtotheLCD;Totransmitacommand,RSwillalreadybelow.subsendCmd(incmdPasbyte)msn=cmdP&0b11110000;gethighnibblemsn=msn/16;shiftrightfourplacessendNib(msn);sendcompletenibblelsn=cmdP&0b00001111;getlownibblesendNib(lsn);sendcompletenibbleendsub;-----SendaCharactertotheLCD;Totransmitacharacter,RSmustbehighsubsendChr(incharPasbyte)msn=charP&0b11110000;gethighnibblemsn=msn/16;shiftrightfourplacesmsn=msn|0b00010000;factorinRSsendNib(msn);sendcompletenibblelsn=charP&0b00001111;getlownibblelsn=lsn|0b00010000;factorinRSsendNib(lsn);sendcompletenibbleendsub;-----ClearthescreensubdoClrsendCmd(clrHome)wait5mS;thiscommandtakesextratimeendsub;-----HomethecursorsubdoHomesendCmd(home)wait5mS;andsodoesthisoneendsub;-----PrintamessagetotheLCD;Theparameter'row'pointstothestartofthestring.subprintMsg(inrowasbyte)sendCmd(line1);getsetforfirstlinefori=0to15index=row*16+iEPreadindex,char;fetchnextcharacterandsendChr(char);transmittotheLCDnextsendCmd(line2);getsetforsecondlinefori=0to15index=(row+1)*16+iEPreadindex,char;fetchnextcharacterandsendChr(char);transmittotheLCDnextendsubHere’sthebodyoftheerror:Two-Line-LCD.gcb(117):Error:SyntaxErrorTwo-Line-LCD.gcb(131):Error:SyntaxErrorTwo-Line-LCD.gcb(147):Error:SyntaxErrorTwo-Line-LCD.gcb(217):Error:SyntaxErrorTwo-Line-LCD.gcb(223):Error:SyntaxErrorAlloftheerrorspointtolinescontainingEPread.The.asmiscreatedhowever,andwhenIcopytheEEPROMcode(withthesemicolonsremoved)totheendofit(andsaveit),IuseMPASMtomakethe.hexfile,butitwon’tduetoerrors:Message[302]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM115:Registerinoperandnotinbank0.Ensurethatbankbitsarecorrect.Error[122]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM350:Illegalopcode(I)Error[122]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM402:Illegalopcode(I)Error[122]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM474:Illegalopcode(I)Message[302]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM652:Registerinoperandnotinbank0.Ensurethatbankbitsarecorrect.Message[302]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM660:Registerinoperandnotinbank0.Ensurethatbankbitsarecorrect.Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM686:Symbolnotpreviouslydefined(SysMultSub)Error[122]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM691:Illegalopcode(INDEX)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM717:Symbolnotpreviouslydefined(SysMultSub)Error[122]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM722:Illegalopcode(INDEX)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM746:Symbolnotpreviouslydefined(SysDivSub)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM779:Symbolnotpreviouslydefined(SysDivSub)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM852:Symbolnotpreviouslydefined(SYSBYTETEMPX)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM855:Symbolnotpreviouslydefined(SYSDIVLOOP)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM860:Symbolnotpreviouslydefined(SYSBYTETEMPA)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM862:Symbolnotpreviouslydefined(SYSBYTETEMPX)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM864:Symbolnotpreviouslydefined(SYSBYTETEMPB)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM866:Symbolnotpreviouslydefined(SYSBYTETEMPX)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM868:Symbolnotpreviouslydefined(SYSBYTETEMPA)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM874:Symbolnotpreviouslydefined(SYSBYTETEMPA)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM876:Symbolnotpreviouslydefined(SYSBYTETEMPB)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM878:Symbolnotpreviouslydefined(SYSBYTETEMPX)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM881:Symbolnotpreviouslydefined(SYSDIVLOOP)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM893:Symbolnotpreviouslydefined(SYSBYTETEMPX)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM896:Symbolnotpreviouslydefined(SYSBYTETEMPA)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM898:Symbolnotpreviouslydefined(SYSBYTETEMPB)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM900:Symbolnotpreviouslydefined(SYSBYTETEMPX)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM904:Symbolnotpreviouslydefined(SYSBYTETEMPB)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM908:Symbolnotpreviouslydefined(SYSBYTETEMPA)Error[113]C:\PIC\PICSTUFF\LCDBACKPACK\CODE\TWO-LINE-LCD.ASM910:Symbolnotpreviouslydefined(SYSBYTETEMPB)Igetthesameresultifcreatethe.asmand.hexwithGCbasicinonestep.Here’stheinterestingpart:IcancompilesucessfullywithanolderversionofGCbasicthatIusedwithTexpad,andMPASMwillcreatethe.hexfilefromthatsuccessfully.Anyhelpappreciated!JackHoffnung
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anobium,
Thanks so much for your reply. The hardware (and software) is from an article written by Thomas Henry in Nuts & Volts magazine, February 2014. The hardware is comprised of a parallel 2 x 16 LCD, a shift register, and a few other components. It is configured such that only 2 inputs are needed from the PIC, clock and data. The software was obtained from a link in the article, and is the code I sent in my prior post. As I noted, it compiles without error in an older version of GCbasic, but with errors from within GCB@SYN, although the .asm is created. However, that .asm file will not assemble.
Thanks again for your help with this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Jack. What version of the compiler? Release date please.
I have attached a modified approach that is intended to compile without the editing of the asm file.
I have made a few other changes to help with usability.
1) Removed the need to edit the ASM
2) You can added and remove the strings a little easier as the reliance on the hardcoded string length for the last string has been removed.
3) You can now address all the strings using the printMsg routine.
4) Tidy up of the use of EPRead.
I cannot test. Sorry, I could not find a 74174 in my lab (I am certain I do have this device!).
You nailed it; I downloaded and reinstalled and it works with no errors. Have to assume the copy I had was somehow corrupted. Sorry you spent so much time on this. Thanks for coming up with the solution!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jack - I can get the code to compile etc. So, I am puzzled.
Where is the original posting as I cannot emulate here as I am not aware of the hardware configuration from this posting.
Anobium,
Thanks so much for your reply. The hardware (and software) is from an article written by Thomas Henry in Nuts & Volts magazine, February 2014. The hardware is comprised of a parallel 2 x 16 LCD, a shift register, and a few other components. It is configured such that only 2 inputs are needed from the PIC, clock and data. The software was obtained from a link in the article, and is the code I sent in my prior post. As I noted, it compiles without error in an older version of GCbasic, but with errors from within GCB@SYN, although the .asm is created. However, that .asm file will not assemble.
Thanks again for your help with this.
Is this the approach? http://web.archive.org/web/19991116110111/http://www.rentron.com/Myke1.htm Seems to go back to articles from 1999.
I could build this if required. This is very similar to the two wire support we have within GCB by using 'LCD_IO 2'.
@Jack. What version of the compiler? Release date please.
I have attached a modified approach that is intended to compile without the editing of the asm file.
I have made a few other changes to help with usability.
1) Removed the need to edit the ASM
2) You can added and remove the strings a little easier as the reliance on the hardcoded string length for the last string has been removed.
3) You can now address all the strings using the printMsg routine.
4) Tidy up of the use of EPRead.
I cannot test. Sorry, I could not find a 74174 in my lab (I am certain I do have this device!).
Last edit: Anobium 2014-09-28
I just typed a lovely response... arghhh. Lost the posting.
I just compiled all ok in the 6 releases I installed. So, this is odd.
Can you please download a new copy of gcb@syn into a new folder and retest? please.
Can you also share with me the architecture of the solution? I will recreated here.
I can provide a one wire LCD 9600 baud control solution. It using serprint or hersprint to complete a similar task.
Hi Anobium,
You nailed it; I downloaded and reinstalled and it works with no errors. Have to assume the copy I had was somehow corrupted. Sorry you spent so much time on this. Thanks for coming up with the solution!
Not a problem.
Using your post as a starting point, I developed a simple, totally GCB inline code technique so no hand editing required to add the EEmem setting code. Please see:
https://sourceforge.net/p/gcbasic/discussion/demonstrationcode/thread/9398c719/