Searching \ for '[PIC]16f877 initialization help' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: '16f877 initialization help'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]16f877 initialization help'
2001\02\17@005650 by Paul Chicofsky

picon face
Hi everybody,
I have problem with recalling the value of the registers.  For example, ihave this  initial part code
 list p=16f877
 include ""
        clr_desplay     equ       H'26'
        curs_home      equ      H'27'
        set_mode        equ      H'28'
        display_on      equ      H'29'     ; I am reading this value b'00101001'
        curser_shft      equ      H'2A'
        func_set          equ      H'2B'
        org       0x0000
        movlw       b'00000001'   ;put 1 in register clr_desplay
        movwf      clr_desplay   
        movlw       b'00000011'   ;
        movwf       curs_home
        movlw       b'00000111'   ;
        movwf      set_mode
        movlw      b'00001111'   ;
        movwf      display_on
        movlw      b'00011111'    ;
  &nbs p;     movwf      curser_shft
        movlw      b'00111000'    ;
        movwf      func_set
 clrf  PORTA
 clrf  PORTB
 clrf  PORTC
 clrf  PORTD
 clrf  PORTE
 bsf  STATUS,5  ; RAM Page 1
 clrf  TRISA
 clrf  TRISB
 clrf  TRISC
 clrf  TRISD
 clrf  TRISE
; -------------------------
; -------------------------
 movlw       b'00000110' ; = all digital
 movwf      ADCON1
 bcf            STATUS,5
; i removed all the delays needed
             call       pic_init
             call       lcd_cmd
              bcf       STATUS,5
              clrf       PORTA
              clrf       PORTD
              clrf       PORTB
              bsf       STATUS,5
              movlw      00h                      ; set PORTD all
    & nbsp;         movwf     TRISD                 ; output
              movlw      B'11111100'         ; set RA0 and RA1
              movwf     TRISA                 ; output
              movlw      B'11111111'         ; set PORTB all
              movwf     TRISB               &nbs p; ; input
              bcf           STATUS,5          ;
(1)             movlw       display_on           ; send 00001111
(2)            movwf       PORTD              ; to port d
(3)             call            com_set
(4)             movlw       func_set              ; send 001110000
 (5)            movwf       PORTD      & nbsp;       ; to port d
 (6)            call            com_set
 (7)            movlw       clr_desplay          ; send 000000001
(8)             movwf       PORTD              ; to port d
(9)             call             com_set
             bcf             PORTA,1           ; comand mode
; call lcd_delay2
             bsf             PORTA,0           ; set enable high
; call lcd_delay2
            bcf             PORTA,0            ; set enable low
; call lcd_delay2
the problem here is that i am reading the register number or its place in the memory not its value.
Line (1) for example should put the value of register desplay_on which is 00001111 to w register and then to port D.  However, I am reading 00101001 instead which i don't have any idea why.  Could anybody please help.
Thank you

Get Your Private, Free E-mail from MSN Hotmail at

-- hint: The list server can filter out subtopics (like ads or off topics) for you. See

2001\02\17@015945 by Tim Hamel

picon face
I don't know about everyone else, but I can't read your code because of the
50 zillion non-breaking spaces. Try again and ye might have success.

Tim Hamel

-- hint: The list server can filter out subtopics
(like ads or off topics) for you. See

2001\02\17@181051 by David Duffy

Paul C wrote:
{Quote hidden}

You are moving the *location* of the ram into w by doing the above!
Use "movf display_on,f" to move the *value* of it into w.

>(2)            movwf       PORTD              ; to port d
>(3)             call            com_set
>(4)             movlw       func_set              ; send 001110000

Same here!

>  (5)            movwf       PORTD      &
>nbsp;       ; to port d
>  (6)            call            com_set
>  (7)            movlw       clr_desplay          ; send 000000001

And again!

{Quote hidden}

I haven't checked anything else to see if it all makes sense but this is a
BTW Paul, please don't post in html as it makes if a lot harder to read. :-(
Hope this helps you with your project.

David Duffy        Audio Visual Devices P/L
U8, 9-11 Trade St, Cleveland 4163 Australia
Ph: +61 7 38210362   Fax: +61 7 38210281
New Web:
New email:

-- hint: The list server can filter out subtopics
(like ads or off topics) for you. See

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