0
\$\begingroup\$

So I am using the ATTiny10 for the first time, and I noticed that even after setting the clock pre-scaler register correctly (0x00 in my case) I had to define a value called F_CPU for the _delay() function to work correctly. but when going over the code example I have there was #define F_CPU 8000000UL. What does the UL mean?

Also if someone can recommend a good book to start with microcontrollers that would be appreciated, too many registers and setup conditions it's overwhelming!.

\$\endgroup\$
  • 3
    \$\begingroup\$ You're telling your C compiler to treat 8000000 as an Unsigned Long integer - also sometimes known as a uint32_t. See this question on Stack Overflow. \$\endgroup\$ – brhans May 21 at 19:11
4
\$\begingroup\$

The "UL" means unsigned long. The C/C++ language defines this and other type specifiers for integer literals. See https://en.cppreference.com/w/cpp/language/integer_literal

\$\endgroup\$
2
\$\begingroup\$

Any C programming reference and manual would tell that. It means that the literal constant of 8 million is unsigned and of type long, which is necessary as it won't fit into standard type of int on an AVR.

Suggestions to what book to buy would be off-topic. AVRs are one of the most simplest microcontrollers with good documentation, application notes and examples.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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