您好,以下是我设置F28027gpio初始化程序,但是GPIO16,17一直高电平,但是GPIO4就可以设置为低电平,不知道怎么回事呢?
EALLOW;
GpioCtrlRegs.GPAQSEL1.all = 0x0000; // GPIO0-GPIO15 Synch to SYSCLKOUT GpioCtrlRegs.GPAMUX1.all = 0x0000; // GPIO functionality GPIO16-GPIO31 GpioCtrlRegs.GPAMUX2.all = 0x0000; // GPIO functionality GPIO16-GPIO31 GpioCtrlRegs.GPADIR.all = 0xFFFF; // GPIO0-GPIO31 are GP OUTputs GpioCtrlRegs.GPAQSEL2.all = 0x0000; // GPIO16-GPIO31 Synch to SYSCLKOUT
GpioDataRegs.GPADAT.all = 0xFFFFFFFF; //GPIO0-GPIO31 initial value are 0
GpioCtrlRegs.GPBMUX1.all = 0x0000; // GPIO functionality GPIO32-GPIO34 GpioCtrlRegs.GPBDIR.all = 0xFFFF; // GPIO32-GPIO34 are OUTputs GpioCtrlRegs.GPBQSEL1.all = 0x0000; // GPIO32-GPIO34 Synch to SYSCLKOUT
GpioDataRegs.GPBDAT.all = 0xFFFFFFFF; //GPIO0-GPIO31 initial value are 0
GpioCtrlRegs.GPAPUD.all = 0xFFFF; // Pullup's disabled GPIO0-GPIO31
GpioCtrlRegs.GPBPUD.all = 0xFFFF; // Pullup's disabled GPIO32-GPIO34
GpioDataRegs.GPACLEAR.bit.GPIO4 = 1;
GpioDataRegs.GPACLEAR.bit.GPIO16 = 1;
GpioDataRegs.GPACLEAR.bit.GPIO17 = 1;
EDIS;
Seven Han:
您试试:
EALLOW;
//Setting-up GPIO16 as Output
GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 0; // GPIO16 = GPIO16
GpioCtrlRegs.GPADIR.bit.GPIO16 = 1; // GPIO16 = output
//Setting-up GPIO17 as Output
GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 0; // GPIO17 = GPIO17
GpioCtrlRegs.GPADIR.bit.GPIO17= 1; // GPIO17 = output
EDIS;
GpioDataRegs.GPACLEAR.bit.GPIO16 = 1;
GpioDataRegs.GPACLEAR.bit.GPIO17 = 1;
您好,以下是我设置F28027gpio初始化程序,但是GPIO16,17一直高电平,但是GPIO4就可以设置为低电平,不知道怎么回事呢?
EALLOW;
GpioCtrlRegs.GPAQSEL1.all = 0x0000; // GPIO0-GPIO15 Synch to SYSCLKOUT GpioCtrlRegs.GPAMUX1.all = 0x0000; // GPIO functionality GPIO16-GPIO31 GpioCtrlRegs.GPAMUX2.all = 0x0000; // GPIO functionality GPIO16-GPIO31 GpioCtrlRegs.GPADIR.all = 0xFFFF; // GPIO0-GPIO31 are GP OUTputs GpioCtrlRegs.GPAQSEL2.all = 0x0000; // GPIO16-GPIO31 Synch to SYSCLKOUT
GpioDataRegs.GPADAT.all = 0xFFFFFFFF; //GPIO0-GPIO31 initial value are 0
GpioCtrlRegs.GPBMUX1.all = 0x0000; // GPIO functionality GPIO32-GPIO34 GpioCtrlRegs.GPBDIR.all = 0xFFFF; // GPIO32-GPIO34 are OUTputs GpioCtrlRegs.GPBQSEL1.all = 0x0000; // GPIO32-GPIO34 Synch to SYSCLKOUT
GpioDataRegs.GPBDAT.all = 0xFFFFFFFF; //GPIO0-GPIO31 initial value are 0
GpioCtrlRegs.GPAPUD.all = 0xFFFF; // Pullup's disabled GPIO0-GPIO31
GpioCtrlRegs.GPBPUD.all = 0xFFFF; // Pullup's disabled GPIO32-GPIO34
GpioDataRegs.GPACLEAR.bit.GPIO4 = 1;
GpioDataRegs.GPACLEAR.bit.GPIO16 = 1;
GpioDataRegs.GPACLEAR.bit.GPIO17 = 1;
EDIS;
mangui zhang:
不行用寄存器set或clear