beautypg.com

2 gpio and external interrupt code examples, 1 gpio example 1: driving outputs on port 0, 2 gpio example 2: receiving inputs on port 1 – Maxim Integrated MAXQ Family Users Guide: MAXQ2010 Supplement User Manual

Page 52: 2 gpio and external interrupt code examples -14, Maxq family user’s guide: maxq2010 supplement

background image

MAXQ Family User’s Guide:

MAXQ2010 Supplement

6-14

6.1.30 External Interrupt Edge Select 2 Register (EIES2, M1[0Ch])

Each bit in this register controls the edge select mode for an external interrupt as follows:
0 = The external interrupt triggers on a rising (positive) edge.
1 = The external interrupt triggers on a negative (falling) edge.
Bit 7: Edge Select for External Interrupt 22 (IT22)
Bit 6: Edge Select for External Interrupt 21 (IT21)
Bit 5: Edge Select for External Interrupt 20 (IT20)
Bit 4: Edge Select for External Interrupt 19 (IT19)
Bit 3: Edge Select for External Interrupt 18 (IT18)
Bit 2: Edge Select for External Interrupt 17 (IT17)
Bit 1: Edge Select for External Interrupt 16 (IT16)
Bit 0: Edge Select for External Interrupt 15 (IT15)

6.2 GPIO and External Interrupt Code Examples

6.2.1 GPIO Example 1: Driving Outputs on Port 0

move PO0, #000h

; Set all outputs low

move PD0, #0FFh

; Set all P0 pins to output mode

6.2.2 GPIO Example 2: Receiving Inputs on Port 1

move PO1, #0FFh

; Set weak pullups ON on all pins

move PD1, #000h

; Set all P1 pins to input mode

nop

; Wait for external source to drive P1 pins

move Acc, PI1

; Get input values from P1 (will return FF if

; no other source drives the pins low)

Bit #

7

6

5

4

3

2

1

0

Name

IT22

IT21

IT20

IT19

IT18

IT17

IT16

IT15

Reset

0

0

0

0

0

0

0

0

Access

rw

rw

rw

rw

rw

rw

rw

rw