Getting Started

(lily) #1

Chapter 4: C Types, Operators, and Expressions


1111000 = 248

00000001 = 1 1111001 = 249

111010 = 250

1111011 = 251

00000110 = 6 1111110 = 254

1111111 = 255

ere random, we’d just see the
aotically. Using binary numbers where the lit LED is

00100000 = 0x20 = 32

microcontroller applications, we will often be dealing with the states of byte-
sized p case


00000000 = 0

00000010 = 2 1

00000011 = 3 (9 thru 247)
00000100 = 4 1111100 = 252
00000101 = 5 1111101 = 253

00000111 = 7
00001000 = 8

Look at our Cylon eye and notice that we have 8 LEDs with one lit at a time
scrolling back and forth. What you are seeing is 8 of the 256 possible states being
presented in a sequence that fools us into thinking we are seeing a back and forth
scrolling motion. If the presentation sequence w
light blinking on and off ch
represented by 1 shown next to the hexadecimal and decimal equivalent, what we
are seeing is:


00000001 = 0x01 = 1
00000010 = 0x02 = 2
00000100 = 0x04 = 4
00001000 = 0x08 = 8
00010000 = 0x10 = 16
00100000 = 0x20 = 32
01000000 = 0x40 = 64
10000000 = 0x80 = 128
01000000 = 0x40 = 64

00010000 = 0x10 = 16
00001000 = 0x08 = 8
00000100 = 0x04 = 4
00000010 = 0x02 = 2
00000001 = 0x01 = 1

In
orts, like Port D. A port is a place where ships come and go, or in the

Free download pdf