Recent Changes - Search:

Introduction to Microcontroller Programming

About PICmicro Chips

Clocking Your PICmicro Devices

E-Blocks

Flowcode Step By Step

PICmicro Projects

Labs

Working in Hex

<^< A Short Test | Course Index | Downloading the Program >^>

If you are working through this as an experienced programmer you will now have a question: "I wonder if Flowcode supports Hexadecimal numbers?"

If you are already feeling overwhelmed then skip this section and come back to it later.

The answer is yes. Hexadecimal, 'Hex' for short, is a more convenient form (for humans) of representing numbers than binary. A binary digit in a number varies between 0 and 1. A decimal digit varies between 0 and 10. A hex digit has 16 possible states. Clearly this is a problem as we have only the digits 0 to 9. To get round this we use the letters A to F to represent the additional 6 digits required. The following table shows the equivalent numbers in decimal, binary and hex:

DecimalBinaryHex
0000000000
1000000011
2000000102
3000000113
4000001004
5000001015
6000001106
7000001117
8000010008
9000010019
1000001010A
1100001011B
1200001100C
1300001101D
1400001110E
1500001111F

Note that we have shown the binary number with 8 digits. This is a handy convention as computers - and our PICmicro chips - store information in groups of 8 bits. A single memory cell inside a PICmicro device varies between 00000000 and 11111111. In decimal this range is 0 to 255. The equivalent in Hex is 0 to FF.

Hex in Flowcode

You can put Hex in Flowcode by preceeding it by the letters '0x' in any of the dialogue boxes. For example:

This is the equivalent to placing the number 11110000 onto port B. In other words it will place a logic 1 (normally 5 volts) onto the top 4 output pins, and a logic 0 (0 volts) onto the bottom 4 pins.

<^< A Short Test | Course index | Downloading the Program >^>

Print - Search - Login

Page last modified on May 07, 2013, at 07:54 AM