0
\$\begingroup\$

I am running a simple blink program in an ATmega2560 with external 8MHz crystal. When I run it in Proteus, the LEDs do not blink. Refer to my files below.

This is the simple blink code. I just add prescaler bits to verify its functionality.

    void setup() {
      noInterrupts();
      CLKPR = 0x80;                           /*Enabling the clock prescaler function*/
      CLKPR = 0x00;                           /*Setting the prescaler to div by 1*/
      interrupts();
    
      pinMode(13, OUTPUT);
    }
    
    void loop() {
      digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(500);                       // wait for a second
      digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
      delay(500);                       // wait for a second
    }

I correctly choose the ATmega2560 with external 8MHz.

screenshot of settings

And this is my circuit in Proteus: (Removing the VDD in reset, AVCC, AREF doesn't help.)

schematic

And I set the fuse bits to work with external crystal:

screenshot

I don't know where I went wrong. Please help.

\$\endgroup\$
1
  • \$\begingroup\$ Just as a matter of convention, you should not have grounds that point "up". \$\endgroup\$
    – Ron Beyer
    Mar 6, 2021 at 17:52

1 Answer 1

1
\$\begingroup\$

You have your LED connected to the wrong pin.

The Arduino mapping does not follow physical pin numbers.

enter image description here

Either change your code to use Digital Pin 16 (which is where you are currently connected), or move your LED over to physical pin 26 (which is Digital Pin 13).

I also don't see Pin 99 (GND) connected anywhere on your schematic... And it is also missing a number of VCC connections and GND pins. I'm not familiar with Proteus so I'm not sure why these pins are missing, but it seems like that would be an important part to have.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you very much @Ron Beyer. The simulation in Proteus works now. The VCC/GND pins in proteus are hidden, it is in default connected to 5V. Thanks! \$\endgroup\$ Mar 6, 2021 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.