Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Using AVR pin as ground not working

2 posters

Go down  Message [Page 1 of 1]

1Using AVR pin as ground not working Empty Using AVR pin as ground not working Sat Aug 06, 2022 2:13 am

Garmur



Hello.
I want to control leds using multiplexing.

The microcontroller is ATmega8 (and even I tried another AVR objectives) but leds do not shine.

I set DDRB = 0b01111111 and PORTB = 0b11111111 for activating pull up resistors.
Then I connect:
PORTB0 --> led --> PORTB7 and does not work.

If I connect:
PORTB0 --> led --> explicit ground does work.

I must use some PORTB pins as ground and I know in real life everything works because I have made that kind of connections.

This simulator is awesome and I do not know if I am missing anything or if led only works if cathode is explicitly connected to ground. Please, help me.

Windows and version 0.4.15-SR10.

2Using AVR pin as ground not working Empty Re: Using AVR pin as ground not working Sat Aug 06, 2022 3:30 pm

arcachofo

arcachofo

I set DDRB = 0b01111111 and PORTB = 0b11111111 for activating pull up resistors.
Then I connect:
PORTB0 --> led --> PORTB7 and does not work.
I think the problem is that PORTB7 is an input and in addition the pullup is ativated:
DDRB = 0b01111111
PORTB = 0b11111111

Try doing this this:
DDRB = 0b11111111
PORTB = 0b01111111

Things you can do in cases like this:
- Measuring the actual voltages in the LED.
- Activating Circuit animation to colorize Wires (in Circuit properties).

Garmur likes this post

3Using AVR pin as ground not working Empty Re: Using AVR pin as ground not working Sat Aug 06, 2022 11:00 pm

Garmur



Thank you  cheers for this help.

I have activated animations and added voltimeter for debugging.

Now I set all pins as outputs and everything works normally.
But using this way I must change my original algorithm and however there is no problem. Smile I am just a hobbyist and I think this simulation must work in the real life too.

I used pins as inputs because I was implementing charliplexing with 7 segments displays.

arcachofo likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum