[DSC] TWR56f8400开发板,闪烁led怎么也不行了

[复制链接]
1155|2
 楼主| hzy1122 发表于 2015-11-6 16:41 | 显示全部楼层 |阅读模式
程序什么地方写的不对吗?


#include "stdio.h"
#include "stdlib.h"
#include "MC56F84789.h"

void delay11(int x);
void GPIOE_Init (void);

void main()
{       
        GPIOE_Init();
        while(1)
        {
//                GPIOE_DR |= (GPIOE_DR_D_0 | GPIOE_DR_D_1 | GPIOE_DR_D_2 | GPIOE_DR_D_3 | GPIOE_DR_D_4 | GPIOE_DR_D_5 | GPIOE_DR_D_6 | GPIOE_DR_D_7 | GPIOE_DR_D_8 | GPIOE_DR_D_9 | GPIOE_DR_D_10 | GPIOE_DR_D_11 | GPIOE_DR_D_12 | GPIOE_DR_D_13 | GPIOE_DR_D_14 | GPIOE_DR_D_15);
                GPIOE_DR = 0xffff;    //   Data Bits
                delay11(0x1ff);
                GPIOE_DR = 0x0000;    //   Data Bits
                delay11(0x1ff);
        }       
}

void GPIOE_Init (void)
{
        /* If the pin is configured as an output, this register is not used.
             GPIOE_PUR = 0xffff;      //Pull Resistor Enable Bits ,  0b1 ==> Pull resistor is enabled   */
        GPIOE_DRIVE = 0xffff;
        GPIOE_DDR = 0xffff;      //     0b1 ==> Pin is an output
        GPIOE_PER = 0;           //Peripheral Enable Bits ,  0b0 ==> Pin is for GPIO (GPIO mode)
        GPIOE_PPMODE = 0;        //Push-Pull Mode Bits  ,  0b0 ==> Open Drain Mode
        GPIOE_DRIVE = 0xffff;
        GPIOE_PUS = 0xffff;      //   Pull Resistor Type Select Bits   ,    0b1 ==> Pullup resistor
        GPIOE_SRE = 0;
}

void delay11(int x)
{
        int i,j;
        for(i=x;i<0x1ff;i++)
        {
                for(j=0;j<0x1ff;j++)
                {
                }       
        }
}
史迪威将军 发表于 2015-11-6 21:07 | 显示全部楼层
GPIOE_DR = 0x0000; 这个是不是只表示输入还是输出?
FSL_TICS_ZJJ 发表于 2015-11-9 10:22 | 显示全部楼层
史迪威将军 发表于 2015-11-6 21:07
GPIOE_DR = 0x0000; 这个是不是只表示输入还是输出?

看你代码DDR是输入输出配置,DR你这边应该是hi输入高还是低的配置。
你写入之后,debug看看,相应的位输入输出是否正确,然后看看你外面的引脚的电平是不是对的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3

主题

8

帖子

0

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