1 / 17

Mikroprotsessorid

Mikroprotsessorid. PIC16F876A KÄSUD 2. NB! Move Literal to f puudub. MOVLW k Pane konstant k registrisse W MOVLW 0x5A. MOVWF f Kopeeri registri W sisu registrisse f MOVWF PORTB. CLRW W = 0 ; Z = 1 CLRW. CLRF f = 0 ; Z = 1 CLRF STATUS.

ianna
Download Presentation

Mikroprotsessorid

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mikroprotsessorid PIC16F876A KÄSUD 2

  2. NB!Move Literal to fpuudub MOVLW kPane konstant k registrisse WMOVLW 0x5A MOVWF fKopeeri registri W sisu registrisse fMOVWF PORTB CLRWW = 0 ; Z = 1CLRW CLRFf = 0 ; Z = 1CLRF STATUS MOVF f,dKopeeri registri f sisu registrisse f või WMOVWF 0x20,0MOVWF 0x20,1 MOVF f,fKopeeri registri f sisu registrisse fMOVWF 0x20,1 d=0: Wd=1: f NB! Mõjub Z-ile

  3. SWAPF f,dSWAPF 0x20,W SWAPF STATUS,fSWAPF STATUS,WSWAPF STATUS,f NB! Sama misMove f to W,aga Z ei muutu d=0: Wd=1: f

  4. Liitmine ja lahutamine LIITMINE 0xFC + 0x03 = 0xFF ; C=00xFC + 0x05 = 0x02 ; C=1 LAHUTAMINE 0x06 - 0x0A = -0x04 ; C=00x0A - 0x06 = 0x04 ; C=1 Kui tulemus on negatiivne, siis C=0Kui tulemus on positiivne, siis C=1 d=0: Wd=1: f

  5. Loogika 0x0F 000011110x5A 01011010 AND: 00001010 Z=0 OR: 01011111 Z=0 XOR: 01010101 Z=0 0x0F 000011110xF0 11110000 AND: 00000000 Z=1 OR: 11111111 Z=0 XOR: 11111111 Z=0 d=0: Wd=1: f

  6. Rotate 00110101 C=1 RLF: 01101011 C=0 00110101 C=1 RRF: 10011010 C=1 d=0: Wd=1: f

  7. Bit Set, Bit Clear BCF f,bSea NULLIKS registri f bitt number bBCF 0x03,0x05 ; RP0 = 0 BSF f,bSea ÜHEKS registri f bitt number bBSF 0x03,0 ; C = 0

  8. GOTO, CALL Aadressi vanemad 2 bitti tulevad registrist PCLATH GOTO 0x50CALL 0x50

  9. Computed GOTO Program Counter on täiesti tavaline register!

  10. Computed GOTO MOVLW 0x06 ADDWF 0x02,1 ; mine siit 6 käsku edasi1.käsk2.käsk3.käsk4.käsk5.käsk6.käsk d=0: Wd=1: f

  11. STACK RETURN CALL PC PC InterruptKatkestus 1 RETFIE PC 2 3 4 5 6 7 8 CALL ja katkestuse ajal kirjutatakse Program Counter Stacki pealmiseks.RETURN ja RETFIE ajal loetakse Stackist pealmine Program Counter.NB! Stack on 13-bitine ja sinna mahub ka see osa,mis muidu on registris PCLATH.Stacki mahub ülimalt 8 CALLi ja katkestust.Edaspidi hakatakse alates esimesest üle kirjutama!

  12. CALL, RETURN Addr0000 MOVLW 0xAA ; W=AA0001 CALL 0x040002 GOTO 0x000003 MOVLW 0x00 ; W=00004 MOVLW 0xFF ; W=FF0005 RETLW 0x55 ; W=55

  13. Tingimuslik suunamine BTFSC f,b (BTFSS f,b)Kui registri f bitt number b on NULL (ÜKS),siis jäta järgmine käsk vahele. NOP d=0: Wd=1: f

  14. Tingimuslik suunamine BTFSC f,b (BTFSS f,b)Kui registri f bitt number b on NULL (ÜKS),siis jäta järgmine käsk vahele. 0000 BTFSC 0x8E,0 ; Kas BOR on null?0001 GOTO 0x03 ; BOR ei olnud null0002 GOTO Kuskile ; BOR oli null0003 BTFSC 0x8E,1 ; Kas POR on null?0003 GOTO 0x05 ; Ka POR ei olnud null0004 GOTO KuskileMujale ; POR oli null0005 TeeMidagiMuud ; Kumbki ei olnud null

  15. Tingimuslik suunamine DECFSZ f,d (INCFSZ f,d)1. Lahuta või liida registrile f üks2. Pane tulemus vastavalt d väärtusele kas registrisse f või registrisse W3. Kui tulemus oli null, siis jäta järgmine käsk vahele. 0000 CLRF 0x200001 COMF 0x20,10002 DECFSZ 0x20,10003 GOTO 0x020004 TeeMidagiMuud d=0: Wd=1: f

  16. Start WDT CLRWDT CLRWDT aeg Reset WDT WDT work SLEEP work SLEEP NOPÄra tee midagi, viida lihtsalt aega (4 OSC takti)

More Related