1 / 23

Mikroprotsessorid

Mikroprotsessorid. PIC16F876A KÄSUD. Instruction decode – mis teha tuleb. Loe mälust. Töötle andmeid. Kirjuta mällu. Käske täidetakse järjest. Peale igat käsku tehakse PC = PC + 1. Erandid: GOTO ja CALL. 1FFFh + 1 = 0000h. PIC16F876A käskude struktuur. Address modes. Käsud registriga.

kipling
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. Instruction decode – mis teha tuleb Loe mälust Töötle andmeid Kirjuta mällu

  3. Käske täidetakse järjest. Peale igat käsku tehakse PC = PC + 1 Erandid: GOTO ja CALL 1FFFh + 1 = 0000h

  4. PIC16F876A käskude struktuur Address modes Käsud registriga Käsud bitiga Käsud konstandiga Absoluutne suunamine Käsud operandita

  5. Kui dest=W, siis • võetakse registri f väärtus, • Tehakse sellega midagi • Tulemus pannakse W-sse • Register f ise ei muutu • Kui dest=f, siis • võetakse registri f väärtus, • Tehakse sellega midagi • Tulemus pannakse f-sse tagasi • Register W ei muutu f tähendab mõnda registrit sellest tabelist W tähendab Work registrit Mälupanga number tuleb registrist STATUS

  6. Move LiidaLahuta Loogika Rotate LiidaLahuta+Tingimuslik suunamine

  7. f tähendab mõnda registrit sellest tabelist Biti seadmine bbb tähendab biti numbrit (0...7) Tingimuslik suunamine

  8. Move LiidaLahuta Loogika NB!Kõik Literali käsud on ainult registriga W Return

  9. Aadressi vanemad 2 bitti tulevad registrist PCLATH Go

  10. PIC16F876A käskude struktuur Address modes Käsud registriga Käsud bitiga Käsud konstandiga Absoluutne suunamine Käsud operandita

  11. Näide: Genereeri PortB abil impulsse Port B Register = 0x55 Kirjuta Register Porti B Inverteeri Register

  12. Register = 0x55 Kirjuta Register Porti B Inverteeri Register

  13. Move Literal to W k->W 11 00xx kkkk kkkk Aadress Bin Hex 0000 0x55 -> W: 11 0000 0101 0101 30 55 Register = 0x55 Kirjuta Register Porti B Inverteeri Register

  14. Move W to f W->f 00 0000 1fff ffff Aadress Bin Hex 0000 0x55 -> W: 11 0000 0101 0101 30 55 0001 W -> 20h: 00 0000 1010 0000 00 A0 Register = 0x55 Kirjuta Register Porti B Inverteeri Register

  15. Move W to f W->f 00 0000 1fff ffff Aadress Bin Hex 0000 0x55 -> W: 11 0000 0101 0101 30 55 0001 W -> 20h: 00 0000 1010 0000 00 A0 0002 W -> PORTB: 00 0000 1000 0110 00 86 Register = 0x55 Kirjuta Register Porti B Inverteeri Register

  16. Aadress Bin Hex 0000 0x55 -> W: 11 0000 0101 0101 30 55 0001 W -> 20h: 00 0000 1010 0000 00 A0 0002 W -> PORTB: 00 0000 1000 0110 00 86 0003 Invert 20h: 00 1001 1010 0000 09 A0 Complement f 00 1001 dfff ffff d=0: dest=Wd=1: dest=f Register = 0x55 Kirjuta Register Porti B Inverteeri Register

  17. Move f to d 00 1000 dfff ffff Aadress Bin Hex 0000 0x55 -> W: 11 0000 0101 0101 30 55 0001 W -> 20h: 00 0000 1010 0000 00 A0 0002 W -> PORTB: 00 0000 1000 0110 00 86 0003 Invert 20h: 00 1001 1010 0000 09 A0 0004 20h -> W: 00 1000 0010 0000 08 20 d=0: dest=Wd=1: dest=f Register = 0x55 Kirjuta Register Porti B Inverteeri Register

  18. Aadress Bin Hex 0000 0x55 -> W: 11 0000 0101 0101 30 55 0001 W -> 20h: 00 0000 1010 0000 00 A0 0002 W -> PORTB: 00 0000 1000 0110 00 86 Invert 20h: 00 1001 1010 0000 09 A0 0003 0004 20h -> W: 00 1000 0010 0000 08 20 0005 Go to 0002: 10 1000 0000 0010 28 02 Go to address 10 1kkk kkkk kkkk Register = 0x55 Kirjuta Register Porti B Inverteeri Register

  19. Aadress Bin Hex 0000 0x55 -> W: 11 0000 0101 0101 30 55 0001 W -> 20h: 00 0000 1010 0000 00 A0 0002 W -> PORTB: 00 0000 1000 0110 00 86 Invert 20h: 00 1001 1010 0000 09 A0 0003 0004 20h -> W: 00 1000 0010 0000 08 20 0005 Go to 0002: 10 1000 0000 0010 28 02 Tehtud! Kas see programm töötab ka? Registrite adresseerimisel peab Banga number olema registris STATUS! GOTO 2 vanemat bitti peavad olema registris PCLATH!

  20. PROCESSOR 16F876A #include "P16F876A.INC" ORG 0x00 MOVLW 0x55 MOVWF 0x20 Loop MOVWF PORTB COMF 0x20,1 MOVF 0x20,0 GOTO Loop End Aadress 0000 0x55 -> W: 0001 W -> 20h: 0002 W -> PORTB: Invert 20h: 0003 0004 20h -> W: 0005 Go to 0002: 1:PROCESSOR 16F876A 2: #include "P16F876A.INC“ 3: 4: ORG0x00 5: 0000 3055 MOVLW 0x556: MOVLW 0x55 0001 00A0 MOVWF 0x207: MOVWF 0x20 8: Loop 0002 0086 MOVWF 0x69: MOVWF PORTB 0003 09A0 COMF 0x20, F10: COMF 0x20,1 0004 0820 MOVF 0x20, W11: MOVF 0x20,0 0005 2802 GOTO 0x2 12: GOTO Loop Hex 30 55 00 A0 00 86 09 A0 08 20 28 02

More Related