Why can't I turn two LEDs on at the same time?

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I have a problem.
Look at this simple code:

#include 
#include "pm.h"
#include "gpio.h"
#include 
#include 
#include 
#include "flashrc.h"

int main(void)
{
    while (1) {
        gpio_set_gpio_pin(AVR_32_PIN_PA07);
        gpio_set_gpio_pin(AVR_32_PIN_PA08);
    }

    return 0;
}

It should turn two LEDs on, but it does NOT
turn any. If I only try to turn one LED on
(only one gpio_set_gpio_pin() function is in
"while" loop), everything works fine.
I use EVK1101.

What is wrong?

Thanks in advance for help.

Regards.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,
I'm sorry but I don't believe that one Led works.
Leds on EVK1101 are low active. Therefore to turn on one Led needs to turn off that port bit and you should use

gpio_clr_gpio_pin(AVR_32_PIN_PA07);

for it.
Do you know that you turn on both Leds but not at the same time? You turn them on one after the other.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I solved this problem. It was all about this that you need clear (not set) pin to turn the led on.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With the eval boards, you need to drive it low to turn on the LED, is that right?

Elect reputable scientists!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,
yes, at least for the four Leds of EVK1101 and the eight (four single and two duo) Leds of EVK1100.