Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Microcontroller how does it execute a program? and how does hexadecimal play a role

  1. Nov 17, 2009 #1
    Hi
    i'm doing a circuits lab in physics at the moment based on programming a PIC16F819 microcontroller. What i dont 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
     
  2. jcsd
  3. Nov 17, 2009 #2

    berkeman

    User Avatar

    Staff: Mentor

    Re: microcontroller how does it execute a program? and how does hexadecimal play a ro

    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 Language instructions. Higher level computer languages like C give you more abstract program control and flow. Higher level languages are compiled into Assembly Language as part of the process of getting the program ready to load and run on your uP or uC (microcontroller).
     
  4. Nov 17, 2009 #3
    Re: microcontroller how does it execute a program? and how does hexadecimal play a ro

    ok but what does the 0x10 mean is this the hexadecimal notation? if so what is the value? how do you work it out?
     
  5. Nov 17, 2009 #4

    berkeman

    User Avatar

    Staff: Mentor

    Re: microcontroller how does it execute a program? and how does hexadecimal play a ro

    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

    .
     
  6. Nov 17, 2009 #5
    Re: microcontroller how does it execute a program? and how does hexadecimal play a ro

    so does 0x40 = 64
    0x41 = 65
    0x60 = 96
     
  7. Nov 17, 2009 #6

    berkeman

    User Avatar

    Staff: Mentor

    Re: microcontroller how does it execute a program? and how does hexadecimal play a ro

    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.
     
  8. Nov 17, 2009 #7
    Re: microcontroller how does it execute a program? and how does hexadecimal play a ro

    thanks forthe tip about the windows calculator didnt know that

    thanks for the help
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Microcontroller how does it execute a program? and how does hexadecimal play a role
  1. How does the TV know (Replies: 11)

Loading...