beautypg.com

4 port pin examples, 1 port pin example 1, 2 port pin example 2 – Maxim Integrated MAXQ7667 User Manual

Page 94: 4 port pin examples -19, Maxq7667 user’s guide

background image

5-19

__________________________________________________________________________________________________________

MAXQ7667 User’s Guide

5.3.4 Port Pin Examples

5.3.4.1 Port Pin Example 1: Driving Outputs on Port 0

move PS0, #000h

; Set the output drive strength to 1 mA (approx)

move PO0, #000h

; Set all outputs low

move PD0, #0FFh

; Set all P0 pins to output mode

5.3.4.2 Port Pin Example 2: Receiving Inputs on Port 0

move PO0, #0FFh

; Set weak pullups ON on all pins

move PD0, #000h

; Set all P0 pins to input mode

nop

; Wait for external source to drive P1

move Acc, PI0

; Get input values from P0

; (will return FF if no other source

; drives the pins low)

PORT P1

PIN

FUNCTION

TYPE

FUNCTION

ENABLED WHEN

MULTIPLEXING/PRIORITIZATION

Special

SCLK—Serial Clock, Master

Mode, Output

Special

SCLK—Serial Clock,

Slave Mode, Input

P1.6/SCLK

Alternate

External Interrupt 6, Input

(EIE1.6) EX6 = 1

This port pin is defaulted as a weak pullup

input after a reset. If interrupt 14 is enabled,

SCLK is not permitted at this pin.

Special

SYNC—Resets the

Synchronous Timer

(SCNT.8) SSYNC_EN = 1

Special

SS—Slave Select for the SPI,

Input, Slave Mode

(SPICN.0) SPIEN = 1

(SPICN.1) MSTM = 0

(SPICN.2) MODFE = 0

Special

SS—Slave Select for the SPI,

Input, Master Mode

(SPICN.0) SPIEN = 1

(SPICN.1) MSTM = 1

(SPICN.2) MODFE = 1

P1.7/SYNC/

SS

Alternate

External Interrupt 7, Input

(EIE1.7) EX7 = 1

This port pin is defaulted as a weak pullup

input after a reset. If the SPI is enabled as a

slave, this pin is the slave select input. If the

synchronous timer has SSYNC_EN = 1, the

next rising edge on this pin causes a reset of

the synchronous timer's count and the

clearing of SSYNC_EN. Note that the rising

edge detection is performed by

synchronizing the input to the CPU clock

(after any clock division), and as such a

high-going pulse must be greater than 2x

TCK to be detected.

Table 5-5. Port P1 Pin Special and Alternate Functions (continued)