Menu

SYSLCDTEMP not valid?

Jason
2007-08-14
2013-05-30
  • Jason

    Jason - 2007-08-14

    I'm attempting to write a program that utilizes an LCD menu system for navigation. I copied / pasted code I found here for an 8-bit parallel interface with an LCD, but I'm getting these errors:

    lcd.h <200>: Error: SYSLCDTEMP is not a valid I/O pin or port
    lcd.h <265>: Error: SYSLCDTEMP is not a valid I/O pin or port

    The code is being written for an 18F452 running at 20Mhz. Any help?

     
    • Hugh Considine

      Hugh Considine - 2007-08-14

      Have you used some #define statements to set up the ports used by the LCD? For 8-bit mode, you'll need some code similar to this:

      #define LCD_IO 8
      #define LCD_RW PORTC.0
      #define LCD_RS PORTC.1
      #define LCD_Enable PORTC.2
      #define LCD_DATA_PORT PORTB

      You'll need to change the values of the constants to match whatever you have connected to your PIC. More info on this is at http://gcbasic.sourceforge.net/help/relevantconstantslcd.htm

       
    • Jason

      Jason - 2007-08-14

      Yep, here is the portion of my code that deals with setting up the LCD constants:

      'LCD configuration
      #define LCD_IO 8
      #define LCD_DB0 PORTC.0
      #define LCD_DB1 PORTC.1
      #define LCD_DB2 PORTC.2
      #define LCD_DB3 PORTC.3
      #define LCD_DB4 PORTC.4
      #define LCD_DB5 PORTC.5
      #define LCD_DB6 PORTC.6
      #define LCD_DB7 PORTC.7
      #define LCD_RS PORTD.0
      #define LCD_Enable PORTD.1
      #define LCD_RW PORTD.2

      DIR PORTC OUT
      DIR PORTD.0 OUT
      DIR PORTD.1 OUT
      DIR PORTD.2 OUT

      I hoped this was correct, are there any problems with it?

       
    • kent_twt4

      kent_twt4 - 2007-08-14

      You have mixed and matched 4bit syntax and 8bit modes.  Individual port pins are used for 4bit modes.  For 8bit mode use:

      #define LCD_DATA_PORT PORTC

      Not:

      #define LCD_DB0 PORTC.0
      #define LCD_DB1 PORTC.1
      #define LCD_DB2 PORTC.2
      #define LCD_DB3 PORTC.3
      #define LCD_DB4 PORTC.4
      #define LCD_DB5 PORTC.5
      #define LCD_DB6 PORTC.6
      #define LCD_DB7 PORTC.7

       
    • Nobody/Anonymous

      Awesome. Well that fixed that problem, but now I have a bigger one. I get these errors:

      http://img.photobucket.com/albums/v704/h4t/errors.gif

      And here is my source code:

      http://files-upload.com/files/435076/BrainMachine.h

      I don't get it, I even changed variable names at the #define area and in the program, only to get the same error >_<

      Is there a good reference I can use to learn BASIC? I am just making this all up as I go :P

       
    • Hugh Considine

      Hugh Considine - 2007-08-15

      I can see two things that need some attention in your program.

      Firstly, GCBASIC has very limited abilities when it comes to dealing with single bits. One thing it cannot do is use an or. Hence, this statement

      if BLeft or BRight then

      is not compiling. The simplest way around this is to create functions called BLeft, BRight, etc, and use them to read the pins and return a byte value. As an example, you'd need to replace

      #define BRight PORTD.6

      with

      function BRight
      BRight = false
      if PORT.6 on then BRight = true
      end function

      This isn't entirely satisfactory, and I'll try to improve the handling of bit variables within a month or two.

      The other alteration needed is simple - just add this line somewhere near the start of the program:

      Dim Label As String

      This makes the Label variable a string - at present, GCBASIC is treating it as a byte.

      I'm not aware of any tutorials for BASIC that are particularly suitable for GCBASIC. All I can recommend is that you look at the help file and maybe some of the example programs or include files.

       
    • Nobody/Anonymous

      Nifty! I didn't realize how exactly functions worked. I discovered the help at /help, and thats really helping a lot. I made the above suggested changes and the program compiled no problem. At least, the compile screen came up and then disappeared before I could read anything, but at least that means no errors!

      Thank you! Oh, and by the way, the Help file is VERY helpful, but I had no idea it was there. You should have a link to gcbasic.sourceforge.net/help on the front page for newbies, its very nice!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.