查看: 4775|回复: 7

[已解决] KL25Z128 引脚设置推挽输出怎么设置(已解决)

[复制链接]

该用户从未签到

11

主题

65

帖子

0

注册会员

Rank: 2

积分
99
最后登录
1970-1-1
发表于 2014-3-10 15:00:11 | 显示全部楼层 |阅读模式
KL25Z128 引脚设置推挽输出怎么设置,用cw10.5,MQX
我知道答案 目前已有6人回答
回复

使用道具 举报

该用户从未签到

11

主题

65

帖子

0

注册会员

Rank: 2

积分
99
最后登录
1970-1-1
 楼主| 发表于 2014-3-10 15:26:28 | 显示全部楼层

回复:KL25Z128 引脚设置推挽输出怎么设置

在下图中,好像没有选项可以用来设置推挽还是开漏
  无标题.png
回复 支持 反对

使用道具 举报

该用户从未签到

145

主题

4926

帖子

0

金牌会员

Rank: 6Rank: 6

积分
9267
最后登录
1970-1-1
发表于 2014-3-10 15:28:26 | 显示全部楼层

RE:KL25Z128 引脚设置推挽输出怎么设置

你好,我们KL25的引脚的硬件结构就是推挽的,不知道你是想设置为上拉,下拉还是开漏什么的呢?
回复 支持 反对

使用道具 举报

该用户从未签到

11

主题

65

帖子

0

注册会员

Rank: 2

积分
99
最后登录
1970-1-1
 楼主| 发表于 2014-3-10 15:32:06 | 显示全部楼层

回复:KL25Z128 引脚设置推挽输出怎么设置

我要设置成开漏怎么设置呢
回复 支持 反对

使用道具 举报

该用户从未签到

10

主题

459

帖子

0

中级会员

Rank: 3Rank: 3

积分
303
最后登录
2024-10-24
发表于 2014-3-10 15:47:23 | 显示全部楼层

回复:KL25Z128 引脚设置推挽输出怎么设置

回复第 4 楼 于2014-03-10 15:32:06发表:
我要设置成开漏怎么设置呢
KL25的IO口默认都是推挽输出的,不支持开漏输出功能的。对于一些具有特殊功能的引脚例外:如UART可以通过SIM_SOPT5寄存器配置,I2C对应的引脚在被使能了I2C功能后会自动设置为开漏。
Capture.PNG
 
回复 支持 反对

使用道具 举报

该用户从未签到

11

主题

65

帖子

0

注册会员

Rank: 2

积分
99
最后登录
1970-1-1
 楼主| 发表于 2014-3-10 16:00:10 | 显示全部楼层

回复:KL25Z128 引脚设置推挽输出怎么设置

好的谢谢,
麻烦你了,
下面的是中PE生成的代码,但是每个代码中都有LDD_TUserData *UserDataPtr  ,请问这个是起什么作用的的,真没看明白
LDD_TDeviceData* POWER_CONTROL_Init(LDD_TUserData *UserDataPtr)
{
/* Allocate device structure */
POWER_CONTROL_TDeviceDataPtr DeviceDataPrv;
/* {MQXLite RTOS Adapter} Driver memory allocation: Dynamic allocation is simulated by a pointer to the static object */
DeviceDataPrv = &DeviceDataPrv__DEFAULT_RTOS_ALLOC;
DeviceDataPrv->UserDataPtr = UserDataPtr; /* Store the RTOS device structure */
/* Configure pin as output */
/* GPIOC_PDDR: PDD|=1 */
GPIOC_PDDR |= GPIO_PDDR_PDD(0x01);                                   
/* Set initialization value */
/* GPIOC_PDOR: PDO|=1 */
GPIOC_PDOR |= GPIO_PDOR_PDO(0x01);                                   
/* Initialization of Port Control register */
/* PORTC_PCR0: ISF=0,MUX=1 */
PORTC_PCR0 = (uint32_t)((PORTC_PCR0 & (uint32_t)~(uint32_t)(
PORT_PCR_ISF_MASK |
PORT_PCR_MUX(0x06)
)) | (uint32_t)(
PORT_PCR_MUX(0x01)
));                                 
/* Registration of the device structure */
PE_LDD_RegisterDeviceStructure(PE_LDD_COMPONENT_POWER_CONTROL_ID,DeviceDataPrv);
return ((LDD_TDeviceData *)DeviceDataPrv);
}
/*
** ===================================================================
**     Method      :  POWER_CONTROL_Deinit (component BitIO_LDD)
*/
/*!
**     @brief
**          Deinitializes the device. Switches off the device, frees
**         the device data structure memory, interrupts vectors, etc.
**     @param
**         DeviceDataPtr   - Device data structure
**                           pointer returned by  method.
*/
/* ===================================================================*/
void POWER_CONTROL_Deinit(LDD_TDeviceData *DeviceDataPtr)
{
(void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
/* GPIOC_PDDR: PDD&=~1 */
GPIOC_PDDR &= (uint32_t)~(uint32_t)(GPIO_PDDR_PDD(0x01));                                   
/* Unregistration of the device structure */
PE_LDD_UnregisterDeviceStructure(PE_LDD_COMPONENT_POWER_CONTROL_ID);
/* Deallocation of the device structure */
/* {MQXLite RTOS Adapter} Driver memory deallocation: Dynamic allocation is simulated, no deallocation code is generated */
}
/*
** ===================================================================
**     Method      :  POWER_CONTROL_SetDir (component BitIO_LDD)
*/
/*!
**     @brief
**         Sets a pin direction (available only if the direction =
**         _[input/output]_).
**     @param
**         DeviceDataPtr   - Device data structure
**                           pointer returned by  method.
**     @param
**         Dir             - Direction to set. Possible values:
**                            - Input
**- Output
*/
/* ===================================================================*/
void POWER_CONTROL_SetDir(LDD_TDeviceData *DeviceDataPtr, bool Dir)
{
(void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
if (Dir) {
/* Output */
GPIO_PDD_SetPortOutputDirectionMask(POWER_CONTROL_MODULE_BASE_ADDRESS, POWER_CONTROL_PORT_MASK);
} else {
/* Input */
GPIO_PDD_SetPortInputDirectionMask(POWER_CONTROL_MODULE_BASE_ADDRESS, POWER_CONTROL_PORT_MASK);
}
}
/*
** ===================================================================
**     Method      :  POWER_CONTROL_PutVal (component BitIO_LDD)
*/
/*!
**     @brief
**         The specified output value is set. If the direction is
**         input
, the component saves the value to a memory or a
**         register and this value will be written to the pin after
**         switching to the output mode (using SetDir(TRUE);
**         see Safe mode
**         property for limitations). If the direction is output,
**         it writes the value to the pin. (Method is available only if
**         the direction = output or
**         input/output
).
**     @param
**         DeviceDataPtr   - Device data structure
**                           pointer returned by  method.
**     @param
**         Val             - Output value. Possible values:
**                            - logical "0" (Low level)
**- logical "1" (High level)
*/
/* ===================================================================*/
void POWER_CONTROL_PutVal(LDD_TDeviceData *DeviceDataPtr, bool Val)
{
(void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
if (Val) {
GPIO_PDD_SetPortDataOutputMask(POWER_CONTROL_MODULE_BASE_ADDRESS, POWER_CONTROL_PORT_MASK);
} else { /* !Val */
GPIO_PDD_ClearPortDataOutputMask(POWER_CONTROL_MODULE_BASE_ADDRESS, POWER_CONTROL_PORT_MASK);
} /* !Val */
}
/*
** ===================================================================
**     Method      :  POWER_CONTROL_ClrVal (component BitIO_LDD)
*/
/*!
**     @brief
**         Clears (set to zero) the output value. It is equivalent to
**         the [PutVal(FALSE)]. This method is available only if the
**         direction = _[output]_ or _[input/output]_.
**     @param
**         DeviceDataPtr   - Pointer to device data
**                           structure returned by  method.
*/
/* ===================================================================*/
void POWER_CONTROL_ClrVal(LDD_TDeviceData *DeviceDataPtr)
{
(void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
GPIO_PDD_ClearPortDataOutputMask(POWER_CONTROL_MODULE_BASE_ADDRESS, POWER_CONTROL_PORT_MASK);
}
/*
** ===================================================================
**     Method      :  POWER_CONTROL_SetVal (component BitIO_LDD)
*/
/*!
**     @brief
**         Sets (to one) the output value. It is equivalent to the
**         [PutVal(TRUE)]. This method is available only if the
**         direction = _[output]_ or _[input/output]_.
**     @param
**         DeviceDataPtr   - Pointer to device data
**                           structure returned by  method.
*/
/* ===================================================================*/
void POWER_CONTROL_SetVal(LDD_TDeviceData *DeviceDataPtr)
{
(void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
GPIO_PDD_SetPortDataOutputMask(POWER_CONTROL_MODULE_BASE_ADDRESS, POWER_CONTROL_PORT_MASK);
}
/*
** ===================================================================
**     Method      :  POWER_CONTROL_NegVal (component BitIO_LDD)
*/
/*!
**     @brief
**         Negates (inverts) the output value. It is equivalent to the
**         [PutVal(!GetVal())]. This method is available only if the
**         direction = _[output]_ or _[input/output]_.
**     @param
**         DeviceDataPtr   - Pointer to device data
**                           structure returned by  method.
*/
/* ===================================================================*/
void POWER_CONTROL_NegVal(LDD_TDeviceData *DeviceDataPtr)
{
(void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
GPIO_PDD_TogglePortDataOutputMask(POWER_CONTROL_MODULE_BASE_ADDRESS, POWER_CONTROL_PORT_MASK);
}
回复 支持 反对

使用道具 举报

该用户从未签到

10

主题

459

帖子

0

中级会员

Rank: 3Rank: 3

积分
303
最后登录
2024-10-24
发表于 2014-3-10 16:19:52 | 显示全部楼层

回复:KL25Z128 引脚设置推挽输出怎么设置

参看此帖:https://www.nxpic.org.cn/bbs/article_1280_579843.html
回复 支持 反对

使用道具 举报

该用户从未签到

145

主题

4926

帖子

0

金牌会员

Rank: 6Rank: 6

积分
9267
最后登录
1970-1-1
发表于 2014-3-11 10:24:00 | 显示全部楼层

RE:KL25Z128 引脚设置推挽输出怎么设置

楼主如果问题解决了,请帮我在标题上标上(已解决)。
方便我查看未结帖。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|恩智浦技术社区

GMT+8, 2025-7-19 01:49 , Processed in 0.105310 second(s), 29 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表