1
\$\begingroup\$

I am confused about how to configure an ATmega16A microcontroller to use an external clock instead of the internal one. I do not know whether I should set up the last bit as 0 or 1 for CKSEL in crystal mode. Why are there three different values given for this last one? Is there any reason or I can choose any one?

Table 8-3 from ATmega16A datasheet

Image source: Microchip (Atmel) ATmega16A datasheet

Null
7,81618 gold badges38 silver badges49 bronze badges
asked May 13, 2023 at 16:03
\$\endgroup\$
6
  • 2
    \$\begingroup\$ What do you mean by "the last bit"? CKSEL1 or CKSEL0? \$\endgroup\$ Commented May 13, 2023 at 16:25
  • 1
    \$\begingroup\$ Muhammad Hamza Farooq - Hi, Please remember the site rule which requires that when a post includes content (e.g. text, image, photo etc.) copied or adapted from elsewhere, that copied content must be correctly referenced. As a minimum, the source webpage or PDF etc. should be linked (references for books / articles should include title, author(s), publisher, edition, page numbers etc.). In order to help you, I found what I believe to be the source PDF link in this case and added it for you. For the future, please remember it's your responsibility to do that :) Thanks. \$\endgroup\$ Commented May 13, 2023 at 16:43
  • 1
    \$\begingroup\$ You are asking about how to set it to external clock, but are pointing to which crystal options you should set. Those are two separate things. Either you set the AVR to use external clock or you set the AVR to use external crystal. Which is it what you want? \$\endgroup\$ Commented May 13, 2023 at 16:53
  • 1
    \$\begingroup\$ @asdfex The CKSEL0. The least significant bit. \$\endgroup\$ Commented May 13, 2023 at 22:17
  • 1
    \$\begingroup\$ Doesn't table 8-4 in the spec sheet give the details of that? \$\endgroup\$ Commented May 14, 2023 at 5:24

1 Answer 1

1
\$\begingroup\$

The last bit of the CKSEL is used to setup the rising time for the clock as shown below from the ATmega16A datasheet. This can be used in the combination with the SUT bits to set up the rising time accordingly. enter image description here

Image source Atmega16A datasheet.

answered May 15, 2023 at 17:18
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.