atmega328p- startup time

Thread Starter

phys8

Joined Sep 16, 2021
20
Hello , I'm using atmega328p in project and I'm using latch circuit (hardware button) , when I press button atmega328p will be powered by 5V and light a led , but my problem is when I push button it takes 3 second to light the led.

I want know what is exactly the problem

Thank you
 

LesJones

Joined Jan 8, 2017
3,570
You will need to give us some idea about how the latching system works. Is it an external latch such as a flipflop, SCR etc or does the push button apply power to the atmega which then drives a transistor or mosfet to short out the push button to maintain the power to the atmega ?

Les.
 

Thread Starter

phys8

Joined Sep 16, 2021
20
You will need to give us some idea about how the latching system works. Is it an external latch such as a flipflop, SCR etc or does the push button apply power to the atmega which then drives a transistor or mosfet to short out the push button to maintain the power to the atmega ?

Les.
the latch circuit , it means that when button pressed the atmega328p will be POWER ON and when I press the button for the second time the atmega328p will be POWER OFF
 

LesJones

Joined Jan 8, 2017
3,570
You still have not answered the question and you have now added an extra requirement. Show us the schematic so we can understand what you are doing.

Les.
 

LesJones

Joined Jan 8, 2017
3,570
Is the LED just connected to the 5 volt power rail for the Atmega328P (I.E controlled by an external latching circuit.) or is it controlled by an I/O pin on the Atmega that has been configured as an output and the push button connected to another I/O pinon the Atmega that has been configured as an input ? Is there any code running in the Atmega or is it a new blank chip that has not been programmed ?
I am running out of ideas of ways to ask you to give us some useful information about what you are trying to do and how you are going about it.

Les.
 

Thread Starter

phys8

Joined Sep 16, 2021
20
Is the LED just connected to the 5 volt power rail for the Atmega328P (I.E controlled by an external latching circuit.) or is it controlled by an I/O pin on the Atmega that has been configured as an output and the push button connected to another I/O pinon the Atmega that has been configured as an input ? Is there any code running in the Atmega or is it a new blank chip that has not been programmed ?
I am running out of ideas of ways to ask you to give us some useful information about what you are trying to do and how you are going about it.

Les.
This is my code
 

Attachments

LesJones

Joined Jan 8, 2017
3,570
Is this Atmega328P being used in an Arduino board or a board based on one of the Arduino versions ?
I an useless at programming in "C" so I can't help much with your program. I can't see how you read the state of an I/O pin to see if the push button is pressed. I thought a "C" program needed a } at the end. Other members will be able to tell you if this is the case.

Les.
 
Top