2x16 lcd not working with pic16f72


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2007
    Location
    Mumbai-INDIA
    Posts
    22

    Smile 2x16 lcd not working with pic16f72

    hi,

    I am new to PBP, I have made small test board for testing my codes using pic16f72 and I have written following code to test 2x16 lcd but it doesnt seem to be working. All I see is black squares.

    My test board with 16f628+lcd with default LCD wiring is working fine and I have tested my few codes On it.

    COULD SOMEBODY PLS POINT OUT WHAT IS THAT I AM MISSING ?
    ************************************************** ******
    'PIC16F72
    DEFINE OSC 10 ' Set the Xtal frequency
    TRISB=%00000011
    TRISA=%00000000
    ' ** Declare LCDOUT Defines **

    DEFINE LCD_DREG PORTB 'LCD data port
    DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4
    DEFINE LCD_RSREG PORTB 'LCD register select port
    DEFINE LCD_RSBIT 2 'LCD register select bit
    DEFINE LCD_EREG PORTB 'LCD enable port
    DEFINE LCD_EBIT 3 'LCD enable bit
    DEFINE LCD_BITS 4 'LCD bus size 4 or 8
    DEFINE LCD_LINES 2 'Number lines on LCD
    PAUSE 2000

    MAIN:

    LCDOUT $FE, 1 'LCD CLR
    LCDOUT $FE, $80, " LINE 1 "
    LCDOUT $FE, $C0, " LINE 2 "
    PAUSE 100

    GOTO MAIN

    ************************************************** ************
    Thanks in advance
    vu2iia

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    PBP's default Oscillator config for the 16F72 is XT.

    For 10mhz, you'll need HS.
    <br>
    DT

  3. #3
    Join Date
    Mar 2007
    Location
    Mumbai-INDIA
    Posts
    22


    Did you find this post helpful? Yes | No

    Smile About 2x16 lcd not working with pic16f72

    THANKS DARREL YOU POINTED out THE RIGHT PROBLEM, LCD IS WORKING NOW


    REGARDS
    VU2IIA
    www.vu2iia.blogspot.com

  4. #4
    manisg84's Avatar
    manisg84 Guest


    Did you find this post helpful? Yes | No

    Post Re: 2x16 lcd not working with pic16f72

    I am also trying to progrma PIC16f72 with LCd jhd162A, but it is not working

    here is my code, anybody suggest where i did the mistake. i am using 4mhz hs oscillator.

    #include <P16f72.inc>
    LCD_DATA EQU PORTC ; PORTC FOR LCD DATA PINS
    LCD_CTRL EQU PORTB ; PORTB SFR register
    TRISA EQU 85h ; TRISA SFR register
    TRISB EQU 86h ; TRISB SFR register
    TRISC EQU 87h ; TRISC SFR register
    STATUS EQU 03h ; STATUS SFR register
    PORTA equ 05

    R1 EQU 21
    R2 EQU 22

    ORG 00
    goto START

    LDELAY
    MOVLW .200 ; 250MS DELAY
    MOVWF R2
    LOOP3 MOVLW .250
    MOVWF R1
    LOOP4 NOP
    NOP
    DECFSZ R1, F
    GOTO LOOP4
    DECFSZ R2, F
    GOTO LOOP3
    RETURN
    SDELAY
    MOVLW .100 ; 250MS DELAY
    MOVWF R2
    LOOP1 MOVLW .250
    MOVWF R1
    LOOP2 NOP
    NOP
    DECFSZ R1, F
    GOTO LOOP2
    DECFSZ R2, F
    GOTO LOOP1
    RETURN
    LCD_INIT
    BCF LCD_CTRL,3
    CALL LDELAY
    MOVLW 0X38
    CALL COMMAND
    CALL LDELAY
    MOVLW 0X0E
    CALL COMMAND
    CALL READY
    MOVLW 0X01
    CALL COMMAND
    CALL READY
    MOVLW 0X06
    CALL COMMAND
    CALL READY
    MOVLW 0X81
    CALL COMMAND
    CALL READY
    MOVLW A'M'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'O'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'N'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'I'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'C'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'A'
    CALL DATADISPLAY
    CALL READY
    MOVLW 0X88
    CALL COMMAND
    CALL READY
    MOVLW A'M'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'O'
    CALL DATADISPLAY
    MOVLW A'N'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'I'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'S'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'H'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'A'
    CALL DATADISPLAY
    CALL READY
    MOVLW 0XC3
    CALL COMMAND
    CALL READY
    MOVLW A'E'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'L'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'E'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'C'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'T'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'R'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'O'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'N'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'I'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'C'
    CALL DATADISPLAY
    CALL READY
    MOVLW A'S'
    CALL DATADISPLAY
    RETURN
    COMMAND MOVWF LCD_DATA
    BCF LCD_CTRL,1
    BCF LCD_CTRL,2
    BSF LCD_CTRL,3
    CALL SDELAY
    BCF LCD_CTRL,3
    RETURN
    DATADISPLAY MOVWF LCD_DATA
    BSF LCD_CTRL,1
    BCF LCD_CTRL,2
    BSF LCD_CTRL,3
    CALL SDELAY
    BCF LCD_CTRL,3
    RETURN
    READY BSF STATUS,5
    MOVLW 0xFF
    MOVWF TRISC
    BCF STATUS,5
    BCF LCD_CTRL,1
    BSF LCD_CTRL,2
    BACK BSF LCD_CTRL,3
    CALL SDELAY
    BCF LCD_CTRL,3
    BTFSC LCD_DATA,7
    GOTO BACK
    BSF STATUS,5
    MOVLW 00
    movwf TRISC
    BCF STATUS,5
    RETURN

    START BSF STATUS,5 ; Select Bank 1
    MOVLW b'00000000' ; PORTA as output
    MOVWF TRISA
    MOVLW b'00000000'
    MOVWf TRISB
    MOVLW b'00000000'
    MOVWF TRISC ; PORTC as output to LCD
    BCF STATUS,5 ; Select bank0
    CALL LCD_INIT
    return

    end

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 2x16 lcd not working with pic16f72

    Quote Originally Posted by manisg84 View Post
    ... here is my code, anybody suggest where i did the mistake. ...
    You didn't use PicBasic Pro ...
    DT

Similar Threads

  1. My LCD code is not working...
    By kvrajasekar in forum mel PIC BASIC
    Replies: 2
    Last Post: - 7th December 2008, 06:41
  2. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 17:56
  3. Simple LCD code not working..
    By davewanna in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th April 2008, 14:55
  4. SOUND makes LCD quit working
    By jderson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th April 2008, 15:12
  5. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 27th June 2007, 00:07

Members who have read this thread : 0

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