winner23 Posted January 11, 2012 Share Posted January 11, 2012 Salut, Am si eu o rugaminte imi poate explica cineva cum functioneaza urmatoarea secventa de cod? Mentionez ca am gasit-o intr-un program si fiind incepator nu am inteles cum functioneaza ...dupa parerea mea ar trebui sa intre in ciclu infinit dar nu o face. ;---------------------------------------------------------------------------WAIT_100ms ;---------------------------------------------------------------------------;intarziere de 100 ms movlw .129 movwf Waux2_SYS_LOOP6 movlw 0 movwf Waux1_SYS_LOOP7 decfsz Waux1,f goto _SYS_LOOP7 decfsz Waux2,f goto _SYS_LOOP6 ;2+1+1+129*(2+256*3+1+2)=99,721 ms movlw .93 movwf Waux1_SYS_LOOP8 decfsz Waux1,f goto _SYS_LOOP8 decfsz Waux2,f ;+2+93*3=100,002 ms return ;+2=100,004 ms;---------------------------------------------------------------------------dupa parerea mea ...ar trebui sa intre in ciclu infinit la sys loop 07 deoarece are o trimitere neconditionata (goto) mentionez ca am cunostinte de java si c /c++ asa ca va rog sa explicati cat mai 'babeste' deoarece nu m-am mai lovit de asm. Deasemenea nu inteleg ce este cu toate calculele de milisecunde .Va multumesc anticipat Link to comment
Eugen_B Posted January 11, 2012 Share Posted January 11, 2012 Iese din loop prin decfsz (decrement file register skip if zero) sare instructiunea gogo cand registrul decrementat este zero, nu ma pricep la asm , a fost primul rezultat pe google. Link to comment
winner23 Posted January 12, 2012 Author Share Posted January 12, 2012 am inteles ....asta era treaba multumesc....poate imi poate explica cineva de ce sunt trecute calculele alea acolo care adunate dau 300 nu 100 ...va multumesc Link to comment
MatyC Posted January 12, 2012 Share Posted January 12, 2012 Acolo calculeaza numarul de cicluri necesare pentru executia acelei bucati de cod. "goto" foloseste 2 cicluri, "movlw" 1 ciclu si tot asa. Durata unui ciclu este dependenta de frecventa de tact. Practic este 1/(FOSC/4) la marea majoritate a microcontrolerelor produse de microchip si se noteaza cu Tcy. Mai multe informatii gasesti si aici http://www.microchip.com/forums/m424143-print.aspx. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now