De presentatie wordt gedownload. Even geduld aub

De presentatie wordt gedownload. Even geduld aub

2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 1  Herhaling: - ACPS - set status, conditioneel uitvoeren - indexed addressing  Nieuw: - CMP, CMN - half-word.

Verwante presentaties


Presentatie over: "2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 1  Herhaling: - ACPS - set status, conditioneel uitvoeren - indexed addressing  Nieuw: - CMP, CMN - half-word."— Transcript van de presentatie:

1 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 1  Herhaling: - ACPS - set status, conditioneel uitvoeren - indexed addressing  Nieuw: - CMP, CMN - half-word and byte instructions - format 2 nd argument (operand 2)  direct aansturen van I/O pinnen (programmed I/O)  oefening: taa-tuu taa-tuu taa-tuu

2 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 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 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 3 ADDR0, R1, R2@ tel op ADDS R0, R1, R2@ en zet status ADDEQ R0, R1, R2@ doe alleen als ‘EQ’ ADDSEQ R0, R1, R2@ combinatie

4 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 4 LDR R0, [ R1 ] LDR R0, [ R1 ], #4 LDR R0, [ R1, #4 ] LDR R0, [ R1, #4 ] !

5 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 5 (herhaling) LDR R0, [ R1 ] R0 R1000 0004 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen

6 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 6 (herhaling) LDR R0, [ R1 ], #4 R0 R1000 0004 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen + 0000 0008

7 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 7 (herhaling) LDRH R0, [ R1, #4 ] R0 R1000 0004 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen + 0000 0008

8 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 8 (herhaling) LDRH R0, [ R1, #4 ] ! R0 R1000 0004 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen + 0000 0008

9 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 9 CMP R1, R2 CMP R1, #15 CMN R1, R2 CMN R1, #10  boek p52 bovenaan + 5.7

10 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 10 CMP R2, R1 R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen - flags

11 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 11 CMN R1, #15 R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen - flags -

12 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 12 Variaties op LDR R0, [ R1 ]: LDR R0, [ R1 ] @ word (32 bit) LDRH R0, [ R1 ] @ half-word (16 bit) LDRB R0, [ R1 ] @ byte (8 bit) - H of B komt achteraan, dus: LDREQB - Let op de alignment van het geheugen adres! - Kan net zo bij STR

13 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 13 MOV R0, R1 ADD R0, R1, #2 SUBC R0, R1, R2, LSL #5 ADDS R1, R2, R3, ASR R4  boek p52..53 + 5.7

14 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 14

15 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 15  LPC2148 architectuur  I/O pin function selection  I/O pin direction selection  I/O pin manipulation

16 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 16

17 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 17 User Manual P.7

18 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 18 User Manual P.8

19 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 19 User Manual P.26 LDR R0,=0 LDR R1,=SCS STR R0,[R1]

20 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 20 User Manual P.75

21 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 21 User Manual P.76

22 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 22 User Manual P.82

23 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 23 User Manual P.82

24 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 24 /* 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”

25 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 25 /* 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

26 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 26 (dit is code voor een LPC2106)

27 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 27 (dit is code voor een LPC2106)

28 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 28 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

29 2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 29 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: 1.Piep gedurende 1 seconde op 1 kHz 2.0.1 seconde stilte 3.Piep gedurende 1 seconde op 2 kHz 4.0.5 seconde stilte Ga uit van de hello.zip als startpunt, de LCD code kan je natuurlijk weglaten.


Download ppt "2007-2008 PEMSY1http://www.voti.nl/hvu/PEMSY1 1  Herhaling: - ACPS - set status, conditioneel uitvoeren - indexed addressing  Nieuw: - CMP, CMN - half-word."

Verwante presentaties


Ads door Google