Microcontroller Question

Discussion in 'Homework Help' started by Madazadm, Jan 8, 2013.

  1. Madazadm

    Thread Starter New Member

    Jan 8, 2013
    5
    0
    Hello everyone,

    I'm struggling with a practice micro controller exam question, and the notes from the lectures are no good at all.

    Please find the images for the question attached.

    For part i) I know the controlling programme begins to run as soon as power is supplied, and vii) the resistors purpose is to prevent oscillation.
    Other than those two I can't get any of them.

    Any help would be greatly appreciated!
     
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    ii.)Well, since Rt and Ct are connected to an oscillator pin...
    (take a look herequantization error, which is likely, but could be much more involved than this.

    ix.) Well, ideally, none, but it depends on the architecture and the device this question is referencing... going off of the datasheet I linked already, pages 52 & 53 should help understand the concept...

    Hope this helps!"> at page 67, Figure 4-5. It shows what this is for a specific device.)

    iii.) after looking at the answer for ii. what will temperature do to a RC time constant?

    iv.) 4 options and each has two states: 2^(n), where n is the number of bits allotted to the representation.

    v.)P = 600W V = 12V... you can do this...

    vi.) What happens to the voltage on a voltage supply when a large current is drained from it?

    viii.) This is dependent on a number of things...It could refer to simply the quantization error, which is likely, but could be much more involved than this.

    ix.) Well, ideally, none, but it depends on the architecture and the device this question is referencing... going off of the datasheet I linked already, pages 52 & 53 should help understand the concept...

    Hope this helps!
     
    Last edited: Jan 8, 2013
    Madazadm likes this.
  3. panic mode

    Senior Member

    Oct 10, 2011
    1,318
    304
    it runs when powered up

    Rt and Ct are time base for internal oscillator (provide clock)

    not suitable for precission timing since oscillator is simple RC type. for precise timing you need crystal (ceramic resonators should also be good enough for many applications).

    2^4=16

    if transistor is operating as a switch (which it should), I=12V/(Rheater + Rds_on) but normally Rds_on of the mosfet is very small and neglected.

    there is no reason that heater cannot be powered from 4.5V too. it is just that 4.5V would need to handle current heater requires.

    330 Ohm resistor is not needed and can (should) be removed. if the transistor was BJT, that resistor would be needed to limit base current.
    100/2^12= 0.0244140625 %

    RB0..RB3 are used as inputs, RB4 is used as output
     
    Madazadm likes this.
  4. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    As tshuck has already hinted at, several of these questions can have several different reasonable answers. This doesn't necessarily make them bad questions, but keep in mind that whoever is grading them is going to base their notion of "reasonable" in the context of what has been taught regarding this topics in this and prior courses, so try not to stray too far out of that box unless you are providing an expanded answer that also covers the most likely point of the question.

    I think ix) could have been worded a bit better. Regardless of whether there are any physical differences between these ports, there most certainly is a difference in how they are being used that requires either a physical difference or a configuration difference between them.

    I don't know that preventing oscillation is a huge factor in vii), there are also considerations about what might happen in various failure modes, like if the gate gets shorted so the source or drain of the transistor. Another consideration could be the current limits of the output pin. If the gate capacitance is too high, the inrush current might be too much and affect the MCU operation. I doubt that is the case with just a single transistor, but reviewing the datasheets will answer it one way or the other.
     
    Madazadm likes this.
  5. Madazadm

    Thread Starter New Member

    Jan 8, 2013
    5
    0
    Thank you very much for the responses! Exactly what I was looking for.

    In your calculation "100/2^12= 0.0244140625 %" Can you tell me why this is the case? I'm guessing the 12 comes from the number of bits, but not sure about the rest.

    Thank you!
     
  6. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    If there are 12 bits, then there are 2^12, or 4096, values that can be represented, each of which represents one least significant bit (lsb) change from the previous value. If the entire span is taken to be 100% of the range, then we have

    (100%/range) / (2^12 lsb/range) ~= 0.025%/lsb
     
    Madazadm likes this.
  7. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    vii) To keep the current at the output pin within specifications. The gate of a MOSFET has capacitance and without the resistor quite high currents can flow through the output pin while switching.
    It's only for a very short time and the circuit might survive without it, but it's safer to include the resistor.
     
    Madazadm likes this.
  8. Madazadm

    Thread Starter New Member

    Jan 8, 2013
    5
    0
    Excellent, cleared everything up for me. Should be able to remember this for the future.

    Was the main reason a separate 12V supply was used for the heated because of the very large current that had to be drawn?

    I'm also having a bit of bother with the next part if someone could give me a few tips, it's to do with creating a flow chart (see attached).

    The basic layout I recall is:
    Start

    Initialisation
    pin RB4 = digital o/p for driving heater
    pins RB(0,1,2,3)=I/ps

    Then at this part it loops through it, starting by checking if the temperature is high enough then polling until it isn't, then switching the heater on then polling until it has reached the limit and then switching off. Then it restarts at the loop.


    Any instruction in the best way to write this part would be great!
     
  9. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    There are a number of reasons why a separate supply might have been used. The heater is rated to operate on 12V so operating it at 4.5V will only put 15% of the power into it. The heater is likely to affect the supply voltage somewhat, particularly when it is turned on (resistive heating elements generally have high inrush currents) so you prefer not to have your digital electronics see those spikes as bad things might happen -- for instance, they might see it as a cycling of the power and reset.

    Your loop probably can simply check the temperature and either turn on or turn off the heater accordingly. This is known as a Bang-Bang controller. What will eventually happen is that the heater will be turned on during some fraction of the time and that will result in the heater running at that same fraction of power output, on average, which will be the right amount of power to make up for the average heat loss in the system. This is particularly the case if the temperature sensor is reasonably near the heating element and if the thermal time constant of the system is much longer than the time it takes to go through the loop. If these are not the case, then a more sophisticated control algorithm might be needed.
     
    Madazadm likes this.
  10. Madazadm

    Thread Starter New Member

    Jan 8, 2013
    5
    0
    Thanks for your very informative reply!

    How is it you worked out the 15% of power in? From P = IV I would have thought it would have been a linear drop, so 37.5%.
    Ah right i see, so keeping them separate is the best option so they do not interfere.

    Excellent, I'll give it a shot writing it based on some of that information. Thanks again!
     
  11. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    P = IV but if you lower V you lower I as well. If using a resistive element, I = V/R so

    P = IV = (V/R)V = (V^2)/R

    Po = (Vo^2)/R

    P/Po = [(V^2)/R]/[(Vo^2)/R]

    P/Po = (V/Vo)^2 = (4.5V/12V)^2 = 0.375^2 = 14.06%
     
  12. Madazadm

    Thread Starter New Member

    Jan 8, 2013
    5
    0
    Ahhhh I see, thanks for clearing that up.
     
Loading...