18F452 and 8-bit LCD


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2006
    Location
    Australia, Gold Coast
    Posts
    31

    Question 18F452 and 8-bit LCD

    Hello,

    It must be late at night...and I am not seeing something. I have connected an LCD (20x4) via 8bit bus and it is refusing to work with the test code below, I am running it on my Easypic board. I thought it must be some other feature on the pins, so I started disabling certain features to no avail.

    The LCD is ok via 4-bit bus. Checked and re-checked connections, etc.

    Many thanks
    AP

    Code:
    ;Settings for 18F452
    
    @ __CONFIG    _CONFIG1H, _HS_OSC_1H 
    @ __CONFIG    _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_42_2L
    @ __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
    @ __CONFIG    _CONFIG3H, _CCP2MX_ON_3H 'CCP2 input/output is multiplexed with RC1
    @ __CONFIG    _CONFIG4L, _LVP_OFF_4L
    
    DEFINE OSC 20
    
    INTCON.7  = 0 'Global Interrupts disable
    INTCON2.7 = 1 'All PORTB pull-ups are disabled
    INTCON3.4 = 0 'Disable PORTB.2 External Interrupt
    TRISE.4   = 0 'Disbale 'Parallel Port Slave'
    ADCON0.0 = 0  'Analog OFF
    
    Define LCD_DREG  PORTD       ' Port for LCD Data
    Define LCD_DBIT  0           ' Use upper 4 bits of Port or Lower 4 Bits
    Define LCD_RSREG PORTB       ' Port for RegisterSelect (RS) bit
    Define LCD_RSBIT 2           ' Port Pin for RS bit
    DEFINE LCD_RWREG PORTB       ' LCD read/write port
    DEFINE LCD_RWBIT 3           ' LCD read/write bit
    Define LCD_EREG  PORTB       ' Port for Enable (E) bit
    Define LCD_EBIT  4           ' Port Pin for E bit
    Define LCB_BITS  8           ' Using 8-bit bus
    Define LCD_LINES 2           ' Using 2 line Display
    DEFINE LCD_COMMANDUS 1500    ' Set command delay time in us
    DEFINE LCD_DATAUS 44         ' Set data delay time in us
    
    
    Pause 450          ' Let LCD Stabalize with a 450ms Pause
    
            
    Main_Loop:
    LCDOUT $FE, 1,  "Hello World 1 2 3   "
    LCDOUT $FE, $C0,"TESTING TESTING !!!!"
    LCDOUT $FE, $94,"ABCDEFghijklmnopqrst"
    LCDOUT $FE, $D4,"LCD 8-Bit BUS Test  "
    
    Pause 1000
    
    GOTo Main_Loop
    "Never under estimate the powers of an idiot"

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    I would change
    "Define LCB_BITS 8"
    to
    "Define LCD_BITS 8"

    And,
    DEFINE LCD_COMMANDUS 1500 ' Set command delay time in us

    to 2500.

    __________________________________________________
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Feb 2006
    Location
    Australia, Gold Coast
    Posts
    31


    Did you find this post helpful? Yes | No

    Default

    Thank you very much Sayzer, it was my silly late night mistake...
    Works well now :-)
    "Never under estimate the powers of an idiot"

Similar Threads

  1. problem with my code
    By civicgundam in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd February 2008, 01:52
  2. How do I get 18f452 pin 10 set as digital input?
    By jessey in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 26th May 2007, 18:32
  3. Why doesn't my code for 18f452 work on 18f252?
    By senojlr in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd December 2005, 02:42
  4. Lcd Menu
    By eliecer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th February 2005, 19:29
  5. 18f452 internal eprom help
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 13th July 2004, 15:50

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts