Jump to content
ELFORUM - Forumul electronistilor

Intrebare subrutina de intarziere


Guest yo9hnh

Recommended Posts

Salutare,am gasit situl acesta care este un generator de cod pentru intarzieri

http://techref.massmind.org/cgi-bin/delay.exe

Si am facut o intarziere de o secunda si acesta este codul :

 

; Delay = 1 seconds

; Clock frequency = 4 MHz

 

; Actual delay = 1 seconds = 1000000 cycles

; Error = 0 %

 

cblock

d1

d2

d3

endc

 

Delay

;999990 cycles

movlw 0x07

movwf d1

movlw 0x2F

movwf d2

movlw 0x03

movwf d3

Delay_0

decfsz d1, f

goto $+2

decfsz d2, f

goto $+2

decfsz d3, f

goto Delay_0

 

;6 cycles

goto $+1

goto $+1

goto $+1

 

;4 cycles (including call)

return

 

 

Acum vine intrebarea , nu inteleg ce fac instructiunile goto $+2 si goto $+1

Mai exact $+2 si $+1 , goto stiu ca directioneaza programul la o anume adresa dar ce reprezinta $+2 si $+1 ?

Link to comment
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

  • MirceaM

    1

Top Posters In This Topic

Cu $ se noteaza de obicei adresa la care se afla instructiunea respectiva.Goto $+1 inseamna salt neconditionat la adresa urmatoare, Goto $+2 inseamna salt peste 2 adrese.

Link to comment
  • 1 month later...

da, asa este. iar in cazul "atragator" in care avem un goto chiar catre instructiunea urmatoare, acesta este pus acolo cu scopul ca sa asigure o anumita intarziere, sa se potriveasca la intarzierea pretinsa de catre secventa / bucla respectiva.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines