1 / 27

Wat gaan we doen?

Wat gaan we doen?. Herhaling: ACPS; indexed addressing; half-word/byte Nieuw: - CMP, CMN - format 2 nd argument (operand 2) direct aansturen van I/O pinnen (programmed I/O) oefening: taa-tuu taa-tuu taa-tuu. ACPS = ARM Procedure Call Standard R0 – R3 : function arguments

dora-doyle
Download Presentation

Wat gaan we doen?

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. Wat gaan we doen? • Herhaling: ACPS; indexed addressing; half-word/byte • Nieuw: - CMP, CMN - format 2nd argument (operand 2) • direct aansturen van I/O pinnen (programmed I/O) • oefening: taa-tuu taa-tuu taa-tuu

  2. ACPS = ARM Procedure Call Standard R0 – R3 : function arguments R0 (R1, R2, R3) : function result R4 - R8 : local scratch R9 : afblijven R10-11 : local scratch R13 : SP R14 : LR R15 : PC R0 – R3 are *not* preserved R4-R8, R10-R11 *are* preserved (boek p175-180)

  3. Herhaling LDR R0, [ R1 ] LDR R0, [ R1 ], #4 LDR R0, [ R1, #4 ] LDR R0, [ R1, #4 ] ! LDRH R0, [ R1 ] LDRB R0, [ R1 ]

  4. (herhaling) LDR R0, [ R1 ] registers geheugen

  5. (herhaling) LDR R0, [ R1 ], #4 + 0000 0008 registers geheugen

  6. (herhaling) LDRH R0, [ R1, #4 ] + 0000 0008 registers geheugen

  7. (herhaling) LDRB R0, [ R1, #4 ] ! + 0000 0008 registers geheugen

  8. CMP, CMN CMP R1, R2 CMP R1, #15 CMN R1, R2 CMN R1, #10 • boek p52 bovenaan + 5.7

  9. CMP R2, R1 - flags registers geheugen

  10. CMN R1, #15 - - flags registers geheugen

  11. Operand 2 MOV R0, R1 ADD R0, R1, #2 SUBC R0, R1, R2, LSL #5 ADDS R1, R2, R3, ASR R4 • boek p52..53 + 5.7

  12. programmed I/O • LPC2148 architectuur • I/O pin function selection • I/O pin direction selection • I/O pin manipulation

  13. User Manual P.7

  14. User Manual P.8

  15. LDR R0,=0 LDR R1,=SCS STR R0,[R1] User Manual P.26

  16. User Manual P.75

  17. User Manual P.76

  18. User Manual P.82

  19. User Manual P.82

  20. /* General Purpose IO 0 */ IO0PIN = 0xe0028000 IO0SET = 0xe0028004 IO0DIR = 0xe0028008 IO0CLR = 0xe002800c /* General Purpose IO 1 */ IO1PIN = 0xe0028010 IO1SET = 0xe0028014 IO1DIR = 0xe0028018 IO1CLR = 0xe002801c /* Pin Connect Block */ PINSEL0 = 0xe002c000 PINSEL1 = 0xe002c004 File (part of): lpc214x.inc Use: #include ”lpc214x.inc”

  21. /* General Purpose IO 0 */ #define IO0PIN (*(volatile unsigned int *)(0xe0028000)) #define IO0SET (*(volatile unsigned int *)(0xe0028004)) #define IO0DIR (*(volatile unsigned int *)(0xe0028008)) #define IO0CLR (*(volatile unsigned int *)(0xe002800c)) /* General Purpose IO 1 */ #define IO1PIN (*(volatile unsigned int *)(0xe0028010)) #define IO1SET (*(volatile unsigned int *)(0xe0028014)) #define IO1DIR (*(volatile unsigned int *)(0xe0028018)) #define IO1CLR (*(volatile unsigned int *)(0xe002801c)) /* Pin Connect Block */ #define PINSEL0 (*(volatile unsigned int *)(0xe002c000)) #define PINSEL1 (*(volatile unsigned int *)(0xe002c004)) File (part of): lpc214x.h

  22. (dit is code voor een LPC2106)

  23. (dit is code voor een LPC2106)

  24. Opdracht (1) Schrijf de subroutines (hou je aan de APCS!): LspInit - geen parameters - maakt de LSP pin een GPIO en output - blijft van de andere pinnen af! LspHigh - geen parameters - neemt aan dat LspInit al is aangeroepen - maakt de LSP pin hoog LspLow - geen parameters - neemt aan dat LspInit al is aangeroepen - maakt de LSP pin laag

  25. Opdracht (2) Schrijf de subroutines (hou je aan de APCS!): LspBeep - R0 = duur van 1 periode in µs - R1 = aantal perioden - gebruikt LspHigh en LspLow Test deze functies door programma te schrijven dat (in een eeuwigdurende lus) het volgende doet: • ‘Piep’ gedurende 1 seconde op 440 Hz • 0.1 seconde stilte • ‘Piep’ gedurende 1 seconde op 880 Hz • 0.5 seconde stilte Ga uit van de blink.zip als startpunt; gebruik #include ”lpc2148.h”

More Related