请教一下,如下图所示,SCL,SDA可做为普通IO口用吗?怎么使用?谢谢
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
复位默认是普通IO口,剩下的就是操作寄存器的事,看数据手册。如下是外设驱动的参考代码,有IO操作的demo
http://www.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=swrc257&fileType=zip
copy一段,很简单,看注释都能明白
输入
P0SEL &= ~P0_PIN; // Select pin to function as General Purpose I/O.
P0DIR &= ~P0_PIN; // Select direction as input.
P0INP &= ~P0_PIN; // Pull up/pull down.
输出
P1SEL &= BIT0; // GPIO.
P1DIR |= BIT0; // Output.
P1_0 = 0; // LED1 off.