Skip to main content
Visitor II
October 11, 2006
Question

Toggling GPIO port

  • October 11, 2006
  • 2 replies
  • 708 views
Posted on October 11, 2006 at 13:38

Toggling GPIO port

    This topic has been closed for replies.

    2 replies

    markolAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:33

    Hello,

    I am unable to toggle bits on ports 3&6. I am using STR912FW44 cpu.

    With this piese of code I want to turn on 8 LED's on port 6

    *(unsigned char*)(GPIO6_BASE + 0x3FC) = 0x00;

    but only first 4 light's up (firs 4 bits). Second half of port simply don't go to low state and I have no idea why.

    Thanks.

    M.

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:33

    put this in your initialization

    //////////////////////////////////////////////////////////////////////////////////////////////////////

    SCU_APBPeriphClockConfig(__GPIO6, ENABLE);

    // GPIO6 goes to the LEDs

    GPIO_DeInit(GPIO6);

    GPIO_StructInit(&GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;

    GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;

    GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;

    GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable;

    GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1;

    GPIO_Init(GPIO6, &GPIO_InitStructure);

    // //////////////////////////////////////////////////////////////////////////////////////////////////////

    and put this in your app

    GPIO_Write(GPIO6, display_byte);