1785 views|2 replies

60

Posts

0

Resources
The OP
 

Please ask a GPIO basic question [Copy link]

This post was last edited by yunhai14 on 2019-3-7 10:22 LPC1768 chip FIO0CLR = 255; //High-speed port output clear register, write 1 to make the corresponding port generate a low level. 255 is 8-bit binary 1111 1111. That is, set P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7 8 pins to 1. Question 1: I only want to set 6 pins from P0.0 to P0.5. What should I do? Question 2: Is P0.0 the leftmost red position or the rightmost blue position? Question 3: If it is the FIO2DIR register, how can I only set P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 and P2.8 P2.9 P2.11 P2.12









This post is from NXP MCU

Latest reply

1) First read the two bits of data that you don't want to change, change the corresponding bits of your 8 bits, and then assign the value. 2) The general writing method is that the low bit is on the far right. 3) port |= BV(1)|BV(2)|...|BV(N) #define BV(X) (1  Details Published on 2019-3-7 12:17
 

6366

Posts

4936

Resources
2
 
Taking MSP430 as an example, bit operations are used to implement I/O input and output control, P1DIR |= BIT0+BIT2+BIT3, P1DIR &= ~(BIT0+BIT2+BIT3)
This post is from NXP MCU
 
 
 

1368

Posts

6

Resources
3
 
1) First read the two bits of data that you don't want to change, change the corresponding bits of your 8 bits, and then assign the value. 2) The general writing method is that the low bit is on the far right. 3) port |= BV(1)|BV(2)|...|BV(N) #define BV(X) (1<
Please ask a GPIO basic question


This post is from NXP MCU
 
Personal signature专注智能产品的研究与开发,专注于电子电路的生产与制造……QQ:2912615383,电子爱好者群: void
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list