Executing Programs on Microcontrollers & Hexadecimal

AI Thread Summary
The discussion centers on programming the PIC16F819 microcontroller and understanding how programs execute. It highlights that transistors form the basis of logic gates and memory storage, which are essential for processing instructions. The conversation explains that hexadecimal notation, such as 0x10, represents values in base 16, with 0x10 equating to 16 in decimal. Additionally, it emphasizes the role of higher-level programming languages, which compile into assembly language for microcontroller execution. Overall, the exchange provides insights into the relationship between programming, current flow, and data representation in microcontrollers.
indie452
Messages
115
Reaction score
0
Hi
i'm doing a circuits lab in physics at the moment based on programming a PIC16F819 microcontroller. What i don't understand is how the program is executed.
I kind of understand that when a pin is logic high voltage then the bit of the number is one and when it is logic low it is zero.

Also i understand that transistors are used to control the flow of current and this current flow results in a change of circuit voltage which represents the bits of information.
But what else is there to know? How does a progam that we write control the current flow and what does the hexadecimal notation have to do with the chip?

any help is welcome thanks
 
Engineering news on Phys.org


indie452 said:
Hi
i'm doing a circuits lab in physics at the moment based on programming a PIC16F819 microcontroller. What i don't understand is how the program is executed.
I kind of understand that when a pin is logic high voltage then the bit of the number is one and when it is logic low it is zero.

Also i understand that transistors are used to control the flow of current and this current flow results in a change of circuit voltage which represents the bits of information.
But what else is there to know? How does a progam that we write control the current flow and what does the hexadecimal notation have to do with the chip?

any help is welcome thanks

There is a good set of articles at HowStuffWorks.com about microprocessors (uPs) and how they work:

http://www.howstuffworks.com/search.php?terms=microprocessor

Transistors are used to make the fundamental building blocks of logic -- logic gates and flip-flops. Flip-flops (FFs) are used as memory to store a single bit. You use sets of FFs to make registers -- a register would be 8 bits wide for the simpler uPs, and can be 16 bits or 32 bits wide or more for more complex uPs.

You use logic gates to route the bits between registers, and the behavior of the logic depends on what is currently in memory, and what your program instructions direct the logic to do. So your program might do something like "Load Register A with 0x10", and then "Increment Register A", and then "Store Register A into memory location 0x1234". Loads, adds, increments, stores, and so on, are typical fundamental uP instructions.


EDIT -- those are fundamental Assembly Langauge instructions. Higher level computer languages like C give you more abstract program control and flow. Higher level languages are compiled into Assembly Langauge as part of the process of getting the program ready to load and run on your uP or uC (microcontroller).
 


berkeman said:
"Load Register A with 0x10", and then "Increment Register A", and then "Store Register A into memory location 0x1234".

ok but what does the 0x10 mean is this the hexadecimal notation? if so what is the value? how do you work it out?
 


indie452 said:
ok but what does the 0x10 mean is this the hexadecimal notation? if so what is the value? how do you work it out?

Yes, that is standard notation for hexidecimal. 0x for hex, 0b for binary.

In base 10, the numbers represent 1's, 10's, 100's, etc, right?

In base 2 (binary) the numbers represent 1's, 2's, 4's, 8's, etc. So 0b10 = 2 in decimal.

In base 16 (hex), the numbers represent 1's, 16's, 256's, etc. So 0x10 = 16 in decimal.

http://en.wikipedia.org/wiki/Hexadecimal

.
 


so does 0x40 = 64
0x41 = 65
0x60 = 96
 


indie452 said:
so does 0x40 = 64
0x41 = 65
0x60 = 96

You're on the right track. One hint -- the Windows Programs>Accessories>Calculator has a hex/decimal conversion capability (when in Scientific mode). Try it out, and you can check your equations above.
 


thanks forthe tip about the windows calculator didnt know that

thanks for the help
 
Back
Top