Enter this topic , of necessity

Status
Not open for further replies.

alsadiq

New Member
hi everybody , i wanna understand the logic of this short code , i think it's easy for members who are skilled in assemply language for pic


;*** Capture guard timer ( 1 milisecound )

movlw d'2'

movwf g_time1

g_loop1 movlw d'124'

movwf g_time2

g_loop2 nop

decfsz g_time2,f

goto g_loop2

decfsz g_time1,f

goto g_loop1
 
alsadiq said:
hi everybody , i wanna understand the logic of this short code , i think it's easy for members who are skilled in assemply language for pic


;*** Capture guard timer ( 1 milisecound ) This is a comment - ignored by averything but the person who reads it

movlw d'2' W register contains the decimal value 2

movwf g_time1 Copy the W register to the variable g_time1

g_loop1 movlw d'124' W register now contains the decimal value 124

movwf g_time2 Copy the W register to g_time2

g_loop2 nop nop means "no operation" - this line just marks g_loop2 as a loction in the code

decfsz g_time2,f decrements the variable g_time2 by 1. Skips the next line if g_time2=zero

goto g_loop2 jumps back to the line g_loop2 nop

decfsz g_time1,f decrements the variable g_time1 by 1. Skips the next line if g_time1=zero

goto g_loop1 jumps back to the line g_loop1 movlw d'124'


The above is a simple delay routine if that helps.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…