Menu

LCD ubable to get to work

Help
2018-04-26
2018-04-29
1 2 > >> (Page 1 of 2)
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-26

    **Hi I am trying to interface a 16x2 alphanumeric lcd to a 16f877a but am having no success ,the hardware works with a different hex file loaded into pic and I can write to the port I have lcd connected to to light up LED 's, I am using a modified version of one of GCB example files.
    Pic chip is using 20mhz Xtal osc.
    Also using command line under ubuntu
    linux.
    This is the version and date of GCB I have installed Version: 0.98.01 2017-10-27
    follows is part of source code.

     #chip 16F877a, 20
     #config BODEN = OFF, PWRTE = ON, WDT = OFF
    
    
      ;Setup LCD Parameters
      #define LCD_IO 8
      ;#define LCD_NO_RW
      #define LCD_SPEED SLOW
    
    ; ----- Define Hardware settings
      #define LCD_RS PORTA.5
      #define lcd_RW PORTA.4
      #define LCD_Enable PORTA.3
      #define LCD_DATA_PORT PORTD
    
    ; ----- Main body of program commences here.
        Do Forever
            CLS
            WAIT 3 s
            PRINT "START TEST"
            locate 1,0
            PRINT "DISPLAY ON"
            wait 3 s
    

    ETC
    Any help appreciated.
    Geoff

     

    Last edit: Geoff Wrightson 2018-04-26
  • Anobium

    Anobium - 2018-04-26

    This code works here.

    #chip 16F877a, 20
     #config BODEN = OFF, PWRTE = ON, WDT = OFF
    
      ;Setup LCD Parameters
      #define LCD_IO 8
      ;#define LCD_NO_RW
      #define LCD_SPEED SLOW
    
    ; ----- Define Hardware settings
      #define LCD_RS PORTA.5
      #define lcd_RW PORTA.4
      #define LCD_Enable PORTA.3
      #define LCD_DATA_PORT PORTD
    
    ; ----- Main body of program commences here.
        Do Forever
            CLS
            WAIT 3 s
            PRINT "START TEST"
            locate 1,0
            PRINT "DISPLAY ON"
            wait 3 s
    loop
    

    Remove LCD_RW and try LCD_NO_RW

     
  • Anobium

    Anobium - 2018-04-26

    post the completed project including the hex, and, the other hex... what source was that? attach this hex.

    just tried on a simulator. also works.

     

    Last edit: Anobium 2018-04-26
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-26

    Hi attached are the hex and asm files I'm having difficulty with and also hex that works with hardware setup, I no longer have source code for it . It was something I was playing with a few years ago possibly written in JAL. but not sure .

     
    • Anobium

      Anobium - 2018-04-26

      I am not certain the old hex is for that chip. Are you 100% certain?

      Also, do you know if the LCD is a 4 bit or 8 bit LCD?

      Can you take a photo of the back?

      Does the chip run? If you connect just an LED via a suitable resistor - and you turn the LED of and off with a small delay. Does the LED flash?

      A photo of your setup/rig/board would also help.

      I can deasm the HEX and this may shed some light on the old HEX.

      I am asking questions like these as we must have 1000's of solutions with LCDs and I do not expect any issues with the library or core LCD functions.

       
      • Geoff Wrightson

        Geoff Wrightson - 2018-04-27

        Hi thanks very much for your help with this much appreciated, yes old hex is definately for this chip and have test with a leds connected to port and all works......... I am using a prototype board that is hard wired to the display port 99% sure lcd is 8 bit, but they are
        several years old model " PVC160202PGN" maybe I should get a new one to try,

         
  • Anobium

    Anobium - 2018-04-26

    Not really sure of the issue here.

    Can download the attached file. Replace the existing library in the ..\GCB@Syn\GreatCowBasic\Include\lowlevel directory. I have changed the init timings to (maybe) better support older LCDs.

    Just to confirm. I have validated this program on real hardware. Only difference is the ports - my board is hard coded. :-)

    #chip 16F877a, 20
    #config BODEN = OFF, PWRTE = ON, WDT = OFF
    
    ;Setup LCD Parameters
    #define LCD_IO 8
    
    #define LCD_SPEED SLOW
    
    ; ----- Define Hardware settings
    #define LCD_RW PORTE.1
    #define LCD_RS PORTE.0
    #define LCD_Enable PORTE.2
    #define LCD_DATA_PORT PORTD
    
    ; ----- Main body of program commences here.
      Do Forever
          CLS
          WAIT 3 s
          PRINT "START TEST"
          locate 1,0
          PRINT "DISPLAY ON"
          wait 3 S
    loop
    
     

    Last edit: Anobium 2018-04-26
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-27

    Hi still no good ........ each bit on portD has a led attached when I run oldhex file they blink away but when I load lcd8-877a.hex there is no activity the chip oscillator is running and the top line of the LCD is 16 full blocks, also did a search for lcd.h and appart form the GCB there is several other files called lcd.h..... no sure if this has any relavance. I will go to the local electronics store in the morning and buy a new lcd and see if that makes any difference tho the one I have works with oldhex file.
    Geoff.

     
  • Anobium

    Anobium - 2018-04-27

    Can you try the 4-bit LCD? But, are you 100% certain about this port assignments? Try the code below but check the port assignments.

    Not sure where you are finding those other LCD.H files - a screen shot would help.

      ;Setup LCD Parameters
      #define LCD_IO 4
      #define LCD_NO_RW
    
      #define LCD_Speed slow
    
      ;Change as necessary
      #define LCD_RS Porta.5
      #define LCD_Enable Porta.3
      #define LCD_DB4 Portd.0
      #define LCD_DB5 Portd.1
      #define LCD_DB6 Portd.2
      #define LCD_DB7 Portd.3
    
     
  • Anobium

    Anobium - 2018-04-27

    And, I cannot load the oldhex into... a simulator, Pk2, pk3 or MPLAB. Errors all the time.

    File has no Config in pk2&pk2, MPLAB states the checksum is incorrect and the file in the emulator is meaningless. So.... how are you programming?

    I have removed the UNIX file format to get the file even to load.

     

    Last edit: Anobium 2018-04-27
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-27

    Hi just tried hex file again "oldf877a.hex" and it works ok , programmed pic using linux program "picprog" I have attached hex again .

     
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-27

    Hi attached is screenshot of lcd.h file locations .

     
  • Anobium

    Anobium - 2018-04-27

    Thank you.

    File photo. We only have one lcd.h relative to Great Cow BASIC. So, no worries there.
    File is not correct. Will not load. There format is one I have never seen before with respect to having two lines of data on one one line.
    Try 4-bit. Please.

     
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-27

    Have tried the 4 bit mode still no go have programmed a 16f887 and bread boarded circuit but still no go I can write to portd and count with led's attached but no go with lcd program there is no activity on data pins monitored with led's . this is the command line I am using " gcbasic /A:GCASM lcd8-887.gcb"

     
    • Anobium

      Anobium - 2018-04-27

      command line looks ok. Send me this whole project in a zip. Let us compare what is being generated.

      I have never seen anything like this - every. Most odd.

       
      • Anobium

        Anobium - 2018-04-27

        just noticed... are you using a 877a or an 877? Last post stated 877.

         
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-27

    I have was originally using a 16f877a on a hardwired prototyping board but last try was using a 16f887 using breadboard but still with same result. I wonder if it is to do with using linux?.
    Attached is zip file.

     
  • Anobium

    Anobium - 2018-04-27

    Nothing obvious.

    change to... guessing your oscillator.

     #config BODEN = OFF, PWRTE = ON, WDT = OFF, osc=EXTRC
    
     
  • Anobium

    Anobium - 2018-04-27

    Hugh and I have looked at this. The original HEX is not valid 'The working hex is weird, all the addresses and line sizes are wrong'. I cannot get this operate on a chip, in a PICKit or MPLAB.

    Can you please a detailed photo of the back on the LCD?

    Try this

     #config BODEN = OFF, PWRTE = ON, WDT = OFF, osc=EXTRC
    

    Evan

     
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-28

    Hi have attached a few photos and will try config line.
    Geoff

     
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-28

    config line made no difference
    checked pulses with cro rs = 6ms low pulse, e = 2ms high pulse; data pulses 2ms.
    geoff

     
  • Anobium

    Anobium - 2018-04-28

    I can confirm this code works. I have built a standalone test rig on a breadboard. i have tested with a number of LCDs all work.

    #chip 16F877a, 20
    
    ;Setup LCD Parameters
    #define LCD_IO 8
    
    #define LCD_SPEED SLOW
    
    ; ----- Define Hardware settings
    #define LCD_RW PORTE.1
    #define LCD_RS PORTE.0
    #define LCD_Enable PORTE.2
    #define LCD_DATA_PORT PORTD
    
    ; ----- Main body of program commences here.
    
      Do Forever
          CLS
          WAIT 1 s
          PRINT "28.04.18:12:11"
          locate 1,0
          PRINT "Anobium"
          wait 5 S
    loop
    

    My guess. Is your board missing a 10k pull-up on MCLR.

     

    Last edit: Anobium 2018-04-28
  • Anobium

    Anobium - 2018-04-28

    I recognise(ish) your board. It is based in the PIC40 board. Should work.

    I cannot datasheet on LCD. Must be old. This could be a timing issue or protocol issue - flying blind without a datasheet.

     
  • Geoff Wrightson

    Geoff Wrightson - 2018-04-28

    Hi attached code works tho only displays 1 character .
    Geoff.

     
    • Anobium

      Anobium - 2018-04-28

      What is different from previous attempts? I would be guessing.

       
1 2 > >> (Page 1 of 2)

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.