求租:MSP430F5310的PU口操作

[复制链接]
4768|3
 楼主| 张允 发表于 2012-4-23 12:05 | 显示全部楼层 |阅读模式
求租:MSP430F5310的PU口操作:
   把MSP430F5310的PU口配置为简单的IO,定义:
  //RXLED             LED4            PU.0       输出,高有效
#define RXLED_OUT             PUCTL |= PUOPE
#define RXLED_HIGH            PUCTL |= PUOUT0
#define RXLED_LOW             PUCTL &= ~PUOUT0

//TXLED             LED5            PU.1       输出,高有效
#define TXLED_OUT             PUCTL |= PUOPE
#define TXLED_HIGH            PUCTL |= PUOUT1
#define TXLED_LOW             PUCTL &= ~PUOUT1

操作函数:
void RxdandTxdLedinit(void)  // 接收发送灯初始化
{
    LDOKEYPID = LDOUNLOCKSPID;   // 寄存器解锁
    PUCTL |= PUOPE;              // PU为输出方式
    RXLED_LOW;                   // PU.0输出0
    TXLED_LOW;                   // PU.1输出0
    //RXLED_HIGH;                  // PU.0输出1
    //TXLED_HIGH;                  // PU.1输出1   
    LDOKEYPID = 0xffff;         // 寄存器“LOCKED”
}

void RxdLedOn(void)           // 接收灯亮
{
    LDOKEYPID = LDOUNLOCKSPID;   // 寄存器解锁
    PUCTL |= PUOPE;              // PU为输出方式
    RXLED_HIGH;                  // PU.0输出1
    LDOKEYPID = 0xffff;         // 寄存器“LOCKED”
}
..............

初始化:
RxdandTxdLedinit();

调用:
TxdLedOn();
RxdLedOn();

现象:仿真:PUCTL为0x23
         LED灯不亮。
备注:LED没有坏,LED灯采用9013驱动,也没有坏。

问题:1、LED等为什么不亮。(排除硬件)
         2、PU口操作是否跟LDO有关。
 楼主| 张允 发表于 2012-4-24 10:43 | 显示全部楼层
有没有人知道呢?
peter_zheng 发表于 2012-4-24 11:22 | 显示全部楼层
//******************************************************************************
//   MSP430F530x Demo - Software Toggle PU.0/1
//
//   Description: Toggle PU.0/1 by xor'ing PU.0/1 inside of a software loop. In
//   the example code, initial configuration is PU.0 = low and PU.1 = high.
//   
//   Note: Since the LDO is not enabled in this case, an external connection
//    between the device VCC and LDOO pin is required for the PortU operation
//
//   ACLK = 32.768kHz, MCLK = SMCLK = default DCO~1MHz
//
//                MSP430F530x
//             -----------------
//         /|\|              VCC|--
//          | |                 |  |
//          --|RST          LDOO|<-
//            |                 |
//            |             PU.0|--> Toggle
//            |             PU.1|--> Toggle (complementary to PU.0)
//
//   B. Nisarga
//   Texas Instruments Inc.
//   Dec 2010
//   Built with CCSv4 and IAR Embedded Workbench Version: 4.21
//******************************************************************************
#include <msp430f5310.h>    // To include latest F530x and F5310 header file v1.1, refer
                            // to the "ReadMe - Header" file in the code ex zip file

void main(void)
{
  volatile unsigned int i;

  WDTCTL = WDTPW+WDTHOLD;                   // Stop WDT
  
  // Configure PU.0 as output pins
  LDOKEYPID = 0x9628;                       // Enable access to config registers
  PUCTL |= PUOPE + PUOUT1;                  // PortU input enable
                                            // PU.0 = low and PU.1 = high
  LDOKEYPID = 0x0;                          // Disbale access to config registers  

  while(1)                                  // continuous loop
  {
    for(i=50000;i>0;i--);                   // Delay
    LDOKEYPID = 0x9628;                     // Enable access to config registers
    PUCTL ^= (PUOUT0 + PUOUT1);             // XOR PU.0/1   
    LDOKEYPID = 0x0;                        // Disbale access to config registers      
  }
}
 楼主| 张允 发表于 2012-4-25 10:47 | 显示全部楼层
我也是这样弄得,就是不行,不知道这句话啥意思:
Note: Since the LDO is not enabled in this case, an external connection
between the device VCC and LDOO pin is required for the PortU operation
您需要登录后才可以回帖 登录 | 注册

本版积分规则

39

主题

402

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部