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

Book Suggestions About Micro-controllers

  1. Apr 24, 2013 #1
    Hi everyone,

    I want to learn about micro-controllers especially PIC. My priorities are below:

    1) I want to learn how a circuit is built. What are the logics to add capacitors, resistors, transistors etc. ?

    2) How can the required capacity for capacitors or resistances of resistors be calculated?

    I will focus on programming later.

    Could you suggest me books, documents, online sources etc?
  2. jcsd
  3. Apr 24, 2013 #2


    User Avatar

    Staff: Mentor

    There should be plenty of application notes at the Microchip website (they make the PIC microcontrollers).
  4. Apr 24, 2013 #3
    (1) What kind of circuit? Microcontrollers can be connected to a very wide range of different circuits, however, the circuits have nothing to do themselves with the microcontroller.

    (2) What capacitance and resistance?

    In general: MicroControllers give us the possibility to process information obtained from a given circuit. For example, in an application I am working on now, a bicycle ergometer is required to adjust the tension of a braking band automatically, in order to ensure that the person on the bike is constantly providing a given power output (Work).

    I use the MicroController for several things:
    - Communication to a serial interface on a computer using UART
    - Digital measurement of the flywheel speed inside the bicycle (via an optocoupler inside the bike)
    - A/D conversion of an analogue signal from a torque sensor
    - Controlling a motor driver chip for a step motor (the motor controlling the braking band strength)
    - Reading digital inputs from security checks inside the bike (making sure the step motor doesn't go beyond some limits)

    These are all the interfaces to the circuits outside the MicroController. How these interfaces are implemented have nothing to do with the MicroController and thus, no book on microcontrollers can teach you how this is done.

    I use OpAmps for buffers and signal amplification. And I use capacitors for filtering the signals.

    But this is all analogue electronics, and I learned how to do this from analogue signal processing. The UART communication is simply just wires, and needs no extra things.
    All I have done MicroController-wise with capacitors is to add them to the supply voltages as decoupling, which is kinda also analogue electronics.

    As a final note, I don't believe there are any books about microcontroller circuits, since there are not "general uC circuits". MicroControllers can be used in almost any kind of circuit.

    There is actually only one thing to learn about MicroControllers, and that is how to program them.

    This post got a bit bigger than expected. Well, hope it gives a bit of perspective on stuff, maybe also for other people.
  5. Apr 24, 2013 #4
    Runei, thank you very much for your information. Firstly I have intended to control LEDs lighting or not lighting in different moments. I also want to add switch buttons as inputs. I can handle the output ones but I don't know how to give a logic 0 or 1 to the inputs.

    I also want to know about the circuits outside the microcontrollers. If you say it is the area of analogue electronics I can investigate it.

    Thanks again for your information.
  6. Apr 24, 2013 #5
    Inputs: If you want to read digital inputs with a MicroController, such as if a button is pressed or not, we use the pins on the MicroController called the GPIO pins (General Purpose Input/Output). These can be set up as inputs or outputs or in some cases both (this depends on the MicroController and setting them up is done in software).
    The "logical 1" is many times given by 3.3 if we are using CMOS standards. Looking in the MicroController datasheet you will be able to find the "logic level standard" that the input and output pins use.
    A lot of times what you want to do is to use a pull-up resistor to 3.3 volts and then if the button is pressed, the input in is shorted to ground. This way the input pin will be an "active low" (meaning the signal will be a logic "0" when we press the button). However on could also use a voltage divider or perhaps some other scheme in order to create the logic levels.

    A good guideline is to say that 3.3 is a logic 1 and a 0 is a logic 0.

    EDIT: But also, as Berkeman says, I believe that if you look at the application notes, you will get an idea of how you design different circuits.

    http://www.microchip.com/wwwcategory/TaxonomySearch.aspx?show=Application Notes&ShowField=no
  7. Apr 24, 2013 #6
    Oh! It has really made my ideas clearer. Even though I get some answers on a scheme in another topic I didn't manage to understand why the input is shorted to ground.

    You can see the scheme here:


    In this scheme I think when the button is pressed input signal will be a logic "1" and when it is not the signal will be logic "0". I thought some current would flow through inputs but if I understand right the input gets signal according to the voltage.

    I have two more questions. If there are no pull down resistors in the scheme;

    1) Wouldn't the input signal be logic "1" when the button is pressed because it would measure 5V?
    2) Wouldn't the input signal be logic "0" when the button is not pressed because it would measure nothing?

    If no why?
  8. Apr 24, 2013 #7
    What is described in that other thread is a "pull-down" instead of "pull-up". You either pull the pin up to a voltage or down to ground, through a resistor, and then you use a switch to short it to the opposite when the switch is activated.

    To your questions:

    (1) It would measure 1 because of 5 V when the button is pressed down, that is correct.

    (2) When no connected to ground it would "probably" show a 0. The problem is, the input pin is what we call "floating", meaning it is not connected to any ground or voltage. This is bad, because "floating" wires are very susceptible to noise from everywhere. So if you took an oscilloscope and looked on the pin, you would see that the voltage was fluctuating up and down all the time. This means that sometimes you COULD see a voltage spike high enough to trigger the logical "1", and depending on what your MicroController is programmed to do, bad things could happen.
  9. Apr 24, 2013 #8
    For PIC 18 architecture and programming using Assembly and C, I would just point at Mazidi's, Mckinlay's and Causey's PIC Microcontroller and Embedded Systems book. I have a microcontroller course this semester and we have this book as the reference. I have to admit that it's one of the best books that I have encountered in electrical engineering. It's very suitable for a student, a hobbyist and even for an experienced engineer.
  10. Apr 25, 2013 #9

    I understand. I have to short it to the ground because I don't want the pin to be affected by the environmental. I think I can do the rest (calculations etc. ) with the analogue electric knowledge. Thank you very much for your nice explanations.

    @Abstr7ct: Thank you for your suggestion I will try to find it and have a look.
  11. Apr 25, 2013 #10
    No you have to connect it through the resistor to ground (pull-down) or to the supply (pull-up). When the switch is pressed, there will be a short to either supply or ground. When the switch is not pressed, we need to make sure that it goes the opposite way.

    - Switch pressed => Short to voltage
    - Switch not pressed => Will be "pulled" to ground through the resistor

    - Switch pressed => Short to ground
    - Switch not pressed => Will be "pulled" to voltage through the resistor
  12. Apr 25, 2013 #11
    Yes, I just talked about the example, but may be with wrong words. I have totally understand the logic behind the circuit now. Thank you very much for your explanations. I think I am able to set up some simple circuits now.

    Further, I will research analogue electronics and some programming. Your comments helped me a lot!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook