Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC ASSEMBLY LANGUAGES QUESTION

Status
Not open for further replies.

ahmad

Member level 1
Joined
Jul 12, 2004
Messages
36
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
malaysia
Activity points
354
Hi there,

| got question to you all, and hope you can give me the answer.

This is a simple delay program which i took from 16F84A PIC CDRom.

Delay
Movlw 0x07
movwf TEMP1 ; TEMP1 = 255
movwf TEMP2 ; TEMP2 = 255
movlw 0x07
movwf TEMP3 ; TEMP3 = 7
DLOOP
decfsz TEMP1, F
goto DLOOP

decfsz TEMP2, F
goto DLOOP

decfsz TEMP3, F
goto DLOOP

retlw 0x00
end

My question is :
1. Why the comment on line 3 say TEMP1 = 255 not 7 but at line 6 TEMP3 = 7

For your information TEMP1 = 0x08 (EEDATA REGISTER)
TEMP2 = 0x09 (EEADRS)
TEMP3 = 0X0A (PCLATH)

2. Why they used EEDATA, EEADRS AND PCLATH register not RAM ?

3. When I changed value of TEMP1 from 7 to FF then the frequency of
LED is become faster not slower as i expected. WHY ???

4. When I declare DATA equ 0x10 (RAM Location) at the top, the compiler say DATA is not declare at the beginning. WHy ??

Anyone please help.

Thanks.
 

Oh boy ... lesson time.
ahmad said:
Delay
Movlw 0x07 ; W = 0x07
movwf TEMP1 ; TEMP1 = W
movwf TEMP2 ; TEMP2 = W
movlw 0x07 ; W = 0x07
movwf TEMP3 ; TEMP3 = W
DLOOP
decfsz TEMP1, F ; TEMP1--; if (TEMP1==0) skip next cmd
goto DLOOP

decfsz TEMP2, F
goto DLOOP

decfsz TEMP3, F
goto DLOOP

retlw 0x00
end
Some pseudocode. Hope you can figure out the rest. Most probably, TEMP1, TEMP2 and TEMP3 are simply general purpose registers.
 

Salam ahmad

List the full program to help you.
What is the PIC16F84A clock value (4Mhz or 10Mhz) ?

Bye
 

ahmad said:
Hi there,

| got question to you all, and hope you can give me the answer.

This is a simple delay program which i took from 16F84A PIC CDRom.

Delay
Movlw 0x07
movwf TEMP1 ; TEMP1 = 255
movwf TEMP2 ; TEMP2 = 255
movlw 0x07
movwf TEMP3 ; TEMP3 = 7
DLOOP
decfsz TEMP1, F
goto DLOOP

decfsz TEMP2, F
goto DLOOP

decfsz TEMP3, F
goto DLOOP

retlw 0x00
end

My question is :
1. Why the comment on line 3 say TEMP1 = 255 not 7 but at line 6 TEMP3 = 7

For your information TEMP1 = 0x08 (EEDATA REGISTER)
TEMP2 = 0x09 (EEADRS)
TEMP3 = 0X0A (PCLATH)

2. Why they used EEDATA, EEADRS AND PCLATH register not RAM ?

3. When I changed value of TEMP1 from 7 to FF then the frequency of
LED is become faster not slower as i expected. WHY ???

4. When I declare DATA equ 0x10 (RAM Location) at the top, the compiler say DATA is not declare at the beginning. WHy ??

Anyone please help.

Thanks.


1.)
Movlw 0x07
movwf TEMP1 ; TEMP1 = 255
movwf TEMP2 ; TEMP2 = 255

After these commands, W = 0x07, therefore understood that TEMP1 = TEMP2 and their contents are 0x07, same with TEMP3.

2.) On what bank they were set? Please check the RP0 and RP1 bits.

3.) Cannot answer that if you will not give us the BANK Status.

4.) Please check your banking. Or DATA is not allowed to be used on the equate directive.
 

Hi there and salam to you sphinx,

Thanks for your respond. Someone came to me and explained everything together with references book from the internet. it really help.

Thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top