Go Down

Topic: Serial print refresh time (Read 3 times) previous topic - next topic


May 25, 2012, 11:28 pm Last Edit: May 25, 2012, 11:33 pm by Arrch Reason: 1
AWOL was right, my example was "rubbish".

They should have been char or byte rather than short. The concept still stands, just didn't have the right type for my example.


Program size that is shown by Arduino is the size of the 'code' portion of the hex file.  Variable declaration data is stored in the same file, but as a separate 'section' of the file, and is not included in the reported program size.  The details of the hex file are a bit more complicated, but if you're feeling particularly ambitious, this page: http://www.nongnu.org/avr-libc/user-manual/mem_sections.html will give you an introduction to how it's laid out.  Just be forewarned, it may only make you more confused than you currently are though.  It isn't beginner material.


Ahh - that would explain perfectly why the size isn't changing! I think I'll leave studying the link too hard for a while! :D

If an int (or a long or anything for that matter) is not defined as either signed, or unsigned - which does it default to? Unsigned I'd presume.


you'd presume wrong.

Some are signed, some are unsigned.

The basic types (int, char, short, etc) are usually signed by default.

Special types defined specifically by the Arduino code (byte, etc) may be unsigned.  You'd have to read the documentation to be sure.

That's why I never use the arduino specific ones and always use proper named ones.

Of course, there are the explicit ones - uint16, etc, where the "u" means unsigned, and the 16 means 16-bit, or 2 bytes.
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10


Okay, I've got what I need to know for this program at least. I can't see saving 1 or 2 bytes here or there are going to help with anything in the long run anyhow - but knowledge is king  ]:)

Thanks to all those who replied for their help!

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview