微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI WIFI设计交流 > cc3200 如何读取某管脚的电平值?有什么接口函数吗?多谢

cc3200 如何读取某管脚的电平值?有什么接口函数吗?多谢

时间:10-02 整理:3721RD 点击:

cc3200 如何读取某管脚的电平值?有什么接口函数吗?多谢

Zhitang,

您好!

请参考我们的Peripheral Driver Library User's Guide. 您可以使用GPIOPinRead来解决,谢谢!

GPIOPinRead ( unsigned long ulPort,
unsigned char ucPins
)

Dear Shelford:

I use GPIOPinRead(GPIOA2_BASE,GPIO_PIN_6) to read the value of SW2 on LP(CC3200-LAUNCHXL PG1.32), no matter how I press SW2 or not, the value I read is always the zero, could you give me suggestion, thanks!

Besides, I am confused about the pin definition for SW2, I saw the description in SWRU372A, there has mis-match on the PIN define between literary(P15) and sample code(GPIO_PIN_6), what is the difference?

Below is the code to try this function~

//-----------------------------------------------------------------------------------------

/* pinmux.c */

// Enable Peripheral Clocks 

PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);

// Configure PIN_15 for GPIO Input

PinTypeGPIO(PIN_15, PIN_MODE_0, false);
GPIODirModeSet(GPIOA2_BASE, 0x40, GPIO_DIR_MODE_IN);

/* main.c */

unsigned long ulPinState;

ulPinState =  GPIOPinRead(GPIOA2_BASE,GPIO_PIN_6);

//---------------------------------------------------------------------

BR

Alan

Dear Shelford:

I made a mistake on missing the focus on the page 13 of SWRU372A, there mentions the SW2 will pulled up to VCC when pressing SW2, so the bit value will be one instead of zero. So the value ulPinState will be 0x40.

BR

Alan

cc3200=msp430+cc3000 熟悉430编程就可以做到的

对不起cc3200=cortex m4+cc3000

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top