define lcd


Closed Thread
Results 1 to 4 of 4

Thread: define lcd

  1. #1
    chip_1's Avatar
    chip_1 Guest

    Question define lcd

    Hi all,
    here show my code for 16F877A.


    Pic 16f877a pin connect to LCD 16x2:

    portb.0 DATA
    portb.1
    portb.2
    portb.3

    portd.0 RS
    portd.3 E
    rw GND


    -------------------------
    DEFINE LCD__DREG PORTB
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTD
    DEFINE LCD_EBIT 3
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE COMMANDUS 2000
    DEFINE LCD_DATAUS 50

    pause 1000

    lcdout $fe,1, "HELLO"
    lcdout $fe,$C0,"WORLD"
    end
    --------------------------------

    but not work. Why?

    THX
    chip_

  2. #2
    Join Date
    May 2005
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    add this

    DEFINE OSC <ur osc>

    i.e:

    DEFINE OSC 20 'for 20 Mhz

    and this line:

    ADCON1 = 7 ' fidn out more here http://www.melabs.com/support/ ' mcu_hints.htm

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    DEFINE LCD__DREG PORTB <<---- The underscore doesn't look right...
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 0

    Double-check your DEFINEs... if you have a spelling or other typo the compiler will NOT flag any error in your DEFINE lines - your program will just not work as expected.

  4. #4
    chip_1's Avatar
    chip_1 Guest


    Did you find this post helpful? Yes | No

    Thumbs up Thx!

    THANK YOU!!!

    for Melanie smack.

    by
    chip_

Similar Threads

  1. Matrix Keypad routine
    By mister_e in forum Code Examples
    Replies: 134
    Last Post: - 18th September 2022, 20:30
  2. RF Modules
    By tonyfelloni in forum mel PIC BASIC Pro
    Replies: 44
    Last Post: - 26th June 2010, 17:42
  3. RX TX modules - intermitent communication
    By ruijc in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 11th June 2009, 00:13
  4. Replies: 8
    Last Post: - 17th September 2006, 17:46
  5. LCD Clock, Interrup
    By Patrick in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th July 2006, 16:00

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