Paul C wrote: >Hi everybody, >I have problem with recalling the value of the registers. For example, >ihave this initial part code > > 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 > 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 > nop > >start > 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 >; >; ------------------------- >; SET ANALOG/DIGITAL INPUTS >; ------------------------- >; > movlw b'00000110' ; = all digital > movwf ADCON1 > bcf STATUS,5 >; i removed all the delays needed >main > call pic_init > call lcd_cmd >pic_init > nop > 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 ; > return >pic_cmd > nop >(1) movlw display_on ; send 00001111 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! >(8) movwf PORTD ; to port d >(9) call com_set > return >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 > return > >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. I haven't checked anything else to see if it all makes sense but this is a start. BTW Paul, please don't post in html as it makes if a lot harder to read. :-( Hope this helps you with your project. Regards... ___________________________________________ 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: www.audiovisualdevices.com.au New email: avd@audiovisualdevices.com.au ___________________________________________ -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics