logo
HomeAbout  |  Products  |  ApplicationsDownload  |  Contact Us  |  中文
 
Home-> Products-> 8-bit MCU
 
IC Induction
Develop & Tool
Application Project
Customer Service
 
Quick Coding
1 IO Ports 2 AD Converter
3 Timers 4 Capture
5 Compare 6 PWM 7 Interval Timer and Buzzer 8 External Interrupts
9 SPI 10 UART 11 LVR 12 Watch Dog Timer
13 STOP Mode 14 HALT Mode    

1 IO Ports

1. Set PortA as input with pulling high

lda #$FF
sta P_IOA_Data ;pull-high
lda #$0
sta P_IOA_Dir ;input
lda #$0
sta P_IOA_Attrib ;PA as pull-high input

2. Set PortA as input with pulling low

lda #$0
sta P_IOA_Data ;pull-low
lda #$0
sta P_IOA_Dir ;input
lda #$0
sta P_IOA_Attrib ;PA as pull-low input

3. Set PortA as input with float

lda #$FF
sta P_IOA_Attrib ;PA as float

4. Set PortA as output

lda #$FF
sta P_IOA_Dir
lda #$0
sta P_IOA_Attrib ;PA as Output

lda #$FF
sta P_IOA_Buf ;Output high

lda #$0
sta P_IOA_Buf ;Output low

5. Use bit operation to set PortA1 as input with pulling high, but do not change other ports.

set P_IOA_Data, 1 ;pull-high
clr P_IOA_Dir, 1 ;input
clr P_IOA_Attrib, 1 ;PA1 as pull-high input

6. Use bit operation to set PortA1 as input with pulling low, but do not change other ports.

clr P_IOA_Data, 1 ;pull-low
clr P_IOA_Dir, 1 ;input
clr P_IOA_Attrib, 1 ;PA1 as pull-low input

7. Use bit operation to set PortA1 as float, but do not change other ports.

set P_IOA_Attrib, 1 ;PA1 as float

8. Use bit operation to set PortA1 as output, but do not change other ports.

set P_IOA_Dir, 1
clr P_IOA_Attrib, 1 ;PA1 as output high

set P_IOA_Buf, 1 ;output high
clr P_IOA_Buf, 1 ; output low

Copyright © BEIJING SUNNORTH TECHNOLOGY CO., LTD Web site:mcu.sunplusmcu.com online real name:凌阳单片机
Unauthorized copy or republish to the content of this website is forbidden. Any one cannot resume on ICP备05061966号