Getting Started

(lily) #1

Chapter 4: C Types, Operators, and Expressions


een on a shirt at a Robothon event:

this doesn’t make sense to you now, it will in a minute.

ies. Later mechanical computers, with brass gears and cams,
ake the slaughter cheaper, quicker, and easier. Then one day a
you could do all this computing even easier if you used

y logic computer entered the world and
now slaughter is so cheap, quick and easy to compute that anybody can do it.
skimming the topic a bit (har!) but a full explanation would begin


he AVR and many other microcontrollers physically handle data in 8-bit units
called bytes, a data type that can have 256 states, 0 thru 255. This is shown in the
llowing sequence of states, (leaving out 9 thru 247, see Appendix 5 to see them
all, and be sure to take a magnifying glass):


Chapter 4: C Types, Operators, and


Expressions


Data Types and Sizes.....................................................................................


S

There are exactly 10 types of people in the world.
Those who understand binary numbers and those who don’t.

If


Bits
The first computers were people with quill pens who spent their lives calculating
tables of things like cannonball trajectories to help soldiers more accurately
slaughter their enem
were developed to m
genius figured that
switches. Switches can be off or on, and the fundamental datum is the ‘bit’ with
exactly two ‘binary’, states. We variously refer to these states as ‘0 and 1’ or ‘on
and off’ or ‘true and false’. It’s the latter that allows us to use bits to automate
Boolean logic and thus the modern binar


Maybe this is
with the first sentence of Genesis and only hit its stride about the time Albert
Turing offed himself as his unjust reward for saving the free world, and while
fascinating, it won’t get us blinking LEDs any quicker, so Let’s move on.


Each of our LEDs is connected to a microcontroller pin that can have two voltage
states: ground or +3v, which can be manipulated as a data bit.


Bytes
T


fo

Free download pdf