Searching \ for '[PIC]:PIC16F877 programing help' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=16F
Search entire site for: 'PIC16F877 programing help'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:PIC16F877 programing help'
2001\01\31@162828 by Paul Chicofsky

picon face
Hi everybody,
The following is my program for PIC16F877 to desplay 'HELLO' in the Hitachi
LCD. The debuger in the MPLAB show that this program work good.  However, in
my circuit I couldn't display anything on the LCD.  The LCD get nothing. Any
help would great
regards
Paul
;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;


       list p=16f877
       include "p16f877.inc"

       __CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _HS_OSC &
_WRT_ENABLE_ON & _LVP_ON & _DEBUG_OFF & _CPD_OFF

       ;; comand modes
clr_display     EQU     01h
curs_home       EQU     02h
set_mode        EQU     07h
display_on      EQU     0Fh     ; display On and blinking cursor
curser_shft     EQU     1Ch
func_set        EQU     38h     ; set it to display 16 characters
temp            EQU     22h
       org     0x000
start
main
       nop
       call    lcd_init
       movlw   display_on      ; put the value 00001111 on register w
       call    lcd_com         ; call the comand function
       movlw   func_set        ; put the value 00111000 on register w
       call    lcd_com         ; call the comand function
       movlw   49h             ; put The letter 'H' on w
       call    lcd_data        ; call data function
       movlw   45h             ; put 'E' in w
       call    lcd_data        ; call data function
       movlw   4Ch             ; put 'L' in w
       call    lcd_data        ; call data function
       movlw   4Ch             ; put 'L' in w
       call    lcd_data        ; call the data function
       movlw   4Fh             ; put 'O' in w
       call    lcd_data        ; call the data function
lcd_init
       nop
       bcf     STATUS,5
       clrf    PORTB
       clrf    PORTD
       bsf     STATUS,5
       movlw   00h             ; set w to 00000000
       movwf   TRISD           ; set port D as Output
       movlw   B'11001011'     ; set w to 11001011
       movwf   TRISB           ; set port B2,B4,B5 as output
       bcf     STATUS,5
       return
lcd_com
       nop
       bsf     PORTB,5         ; B5 high this is Enable in the LCD
       bsf     PORTB,4         ; B4 high This is RS in the LCD
       bcf     PORTB,2         ; B2 low This is R/W in the LCD
       movwf   PORTD           ; put the value in w to Port D
       bcf     PORTB,5         ; set B5 to low
       call    lcd_delay       ; call delay
       bsf     PORTB,5         ; set B5 to high
       return
lcd_delay
       nop
       decfsz  temp,F
       goto    lcd_delay
       return
lcd_data
       nop
       bsf     PORTB,5
       bcf     PORTB,2
       bcf     PORTB,4
       movwf   PORTD
       bcf     PORTB,5
       call    lcd_delay
       bsf     PORTB,5
       end
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2001\01\31@173341 by Stuart O'Reilly

flavicon
face
Do you have the R/W line on the lcd tied low?
Regards
Stuart

Paul Chicofsky wrote:
{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu


2001\01\31@174804 by Tony Nixon

flavicon
picon face
part 1 1483 bytes content-type:text/plain; charset=us-ascii (decoded 7bit)

Paul Chicofsky wrote:
>
> Hi everybody,
> The following is my program for PIC16F877 to desplay 'HELLO' in the Hitachi
> LCD. The debuger in the MPLAB show that this program work good.  However, in
> my circuit I couldn't display anything on the LCD.  The LCD get nothing. Any
> help would great
> regards
> Paul
>         nop
>         call    lcd_init
>         movlw   display_on      ; put the value 00001111 on register w
>         call    lcd_com         ; call the comand function
>         movlw   func_set        ; put the value 00111000 on register w
>         call    lcd_com         ; call the comand function
>         movlw   49h             ; put The letter 'H' on w
>         call    lcd_data        ; call data function

There doesn't appear to be a complete set of initialize codes

>         bsf     PORTB,5
>         bcf     PORTB,2
>         bcf     PORTB,4

This is not a good way to set bits from a PORT as errors may occur.

At least provide some small clocking delay between each instruction
which may also make the LCD a bit happier.

You have not set some TRIS registers and have probably left them as
unconnected inputs. This may also cause problems.

Here is some basic LCD code for a '877 that flashes "Hello from the
16F877" and is set up for your port connections.



--
Best regards

Tony

mICro's
http://www.picnpoke.com
.....salesKILLspamspam.....picnpoke.com


part 2 1530 bytes content-type:application/x-zip-compressed; name=lcd.zip (decode)

part 3 105 bytes
--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


2001\01\31@175010 by Tony Nixon

flavicon
picon face
Stuart O'Reilly wrote:
>
> Do you have the R/W line on the lcd tied low?
> Regards
> Stuart
>
> Paul Chicofsky wrote:
> >

> >         bcf     PORTB,2         ; B2 low This is R/W in the LCD



--
Best regards

Tony

mICro's
http://www.picnpoke.com
salesspamspam_OUTpicnpoke.com

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestKILLspamspammitvma.mit.edu


2001\01\31@230731 by Paul Chicofsky

picon face
Hi,
yes Stuart i have it grounded.  You know why?  because i have done the same
circuit so the LCD can work manualy and at that point i had the R/W
grounded. I didn't have to write any thing at that point. I know there is
something wrong but i thought i can implement the same circuit with the pic.
 Can you help please if you have any ideas.
Regards,

Paul

{Quote hidden}

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestEraseMEspam.....mitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...