Connect with us

Question about pic16f676

Discussion in 'Electronic Basics' started by capitano, Jul 25, 2003.

Scroll to continue with content
  1. capitano

    capitano Guest




  2. I had a quick look - If you use only one ADC input (1 channel) and no Vref+,
    then you have exactly 11 pins available for digital i/o. With some clever
    multiplexing you can get a few more pins if necessary. For example, you can
    easily use the 7 segment bus pins as inputs to poll switches etc. when the
    display is off.

    Nice IC the F676, having 8 ADC inputs on a 14-pin package...!

    Costas
    _________________________________________________
    Costas Vlachos Email:
    SPAM-TRAPPED: Please remove "-X-" before replying
     
  3. the Wiz

    the Wiz Guest

    No, you need 11 control leads to the led display. A little bit of binary logic
    would let you select one of 3 digits with 2 leads, and one of 7 segments with 3
    leads. This would require more sophisticated logic, but would allow you to
    control the display with 5 leads.


    More about me: http://thelabwiz.home.mindspring.com/
    VB3 source code: http://thelabwiz.home.mindspring.com/vbsource.html
    VB6 source code: http://thelabwiz.home.mindspring.com/vb6source.html
    VB6 - MySQL how to: http://thelabwiz.home.mindspring.com/mysql.html
    My newest language - NSBasic for the Palm PDA: http://thelabwiz.home.mindspring.com/nsbsource.html
    Drivers for Pablo graphics tablet and JamCam cameras: http://home.earthlink.net/~mwbt/
    johnecarter atat mindspring dotdot com. Fix the obvious to reply by email.
     
  4. capitano

    capitano Guest

    I had a quick look - If you use only one ADC input (1 channel) and no Vref+,
    Don't I need to connect am oscillator though ? If so we have at the most
    9 outputs ?
     
  5. capitano

    capitano Guest

    No, you need 11 control leads to the led display. A little bit of binary logic
    Two questions come to mind,

    Is there a device that take 2 inputs and will switch on one of for outputs,
    i.e. a unique output or each binary value ? and

    Is there a device that will drive a seven segment led display from a 4 pin
    binary input ?
     


  6. Nope. Use the internal one. It's 4MHz and accurate to 1%. If you need more
    accuracy you can either sacrifice one pin and use an external crystal osc,
    or connect the crystal to the PIC in which case you sacrifice two pins. If
    your application is not very time-critical, the internal 4MHz osc should do
    just fine and you'll have 11 pins available.

    Costas
     


  7. There are ICs that can accomplish both of these tasks. I can't recall part
    numbers, been a very long time since I last used them. Perhaps someone else
    can comment on that. Do a search for "BCD to decimal" and "BCD to
    7-segment". But, since you're using a PIC, I'd say think smart and try to
    make as much use of it as possible. Instead of using discretes, why not use
    a bigger PIC like the 16F872 or F876 instead? Everything in one IC, nice and
    neat. And fully reprogrammable. Want to change the way "6" looks like on
    your displays? Simple! Just reprogram the PIC with zero cost. Try to do the
    same with discretes...

    Costas
     
  8. capitano

    capitano Guest

    There are ICs that can accomplish both of these tasks. I can't recall part
    Yes, an 18 pin pic will solve all possible problems. I am currently in the learning
    phase, so all I have is pickit1, which doesn't do more than 14 pins, but I think
    it will be sufficient after all (as we discussed in the other "sub-thread").
     
  9. TTL 74139 dual 2 line to 4 line decoder
    TTL 7447 7448 7449 BCD to 7 segment decoders

    Cheers
    John Damm Sørensen
     


  10. The Vref+ is needed whenever you need accurate measurements. You normally
    connect the Vref+ pin to a voltage reference source, whose only purpose is
    to supply the ADC module of the PIC with an ultra-stable voltage. Any signal
    in the ADC inputs will then be "referenced" to that ultra-stable voltage.
    The PIC will still be powered by the usual 5V source. If you don't use
    Vref+, the ADC will use the 5V as the reference, so any variation in voltage
    will be reflected in the measurements as an error. If your application does
    not require very good accuracy, you don't need to use Vref+. Just bypass the
    PIC with a 4.7uF tantalum (or even a 0.1uF ceramic) as close as possible to
    its supply pins and you'll be OK. Make sure you use a well-regulated source
    (like that from a 7805 or something similar).

    Good luck.

    Costas
     


  11. Nice tricks! The way you handle the 4 switches is exactly what I meant
    above. Saves you loads of pins with only 1 extra resistor per switch. Just
    make use D4-D7 are outputs only during the LCD updates, so that current
    consumption is minimised (in case the user keeps holding the buttons down
    for some reason).

    In your circuit, doesn't the LCD support 4-bit mode? If so, you can save an
    extra 4 pins at the expense of a little bit more complex code (sending two
    nibbles instead of one byte at a time).

    Happy PIC'ing everyone!

    Costas
     
  12. A E

    A E Guest

    That's right. Updating the LCD happens rarely, only when a switch is pressed.
    The rest of the time those bus lines are in input mode with weak pull ups. The
    1K has no problems pulling that down, and the PIC has no problems driving that
    when in output mode. However, I did find out that the ENB/clock signal doesn't
    need to be there all the time, after sending the bytes, I can yank that wire out
    of there and the display keeps working, the cursor keeps flashing... Very odd.
    According to the datasheet, there isn't a way to specify that AFAICT. It's a
    pretty old module from the 1980's. I can't find anything else for it on the net.
    I had them lying around and they were small enough to fit in the box, and
    besides, surplus places in Montreal are few and far between, I couldn't find
    anything else.
    Adding a SWAPF and a ANDWF and a IORWF
    And soon, AVRing too.
     
  13. capitano

    capitano Guest

    The Vref+ is needed whenever you need accurate measurements. You normally
    Understood. When you say bypass (I am not very strong on jargon) you simply
    mean to connect the capacitor from the plus to the minus as close to the picmicro
    as possible. I'll do that. Thanks.
     
  14. Steve

    Steve Guest

    What I want to do is display a value (MPH) on three 7 segment numeric
    displays: 000 - 999

    Here are the criteria

    1/ No PIC's
    2/ Usual junkbox components
    3/ IC's o.k. as long as their not programmed- must be readily available

    Value must be derived from the following information:

    Distance = 164' (or 1.98 miles - long story but both are correct)
    Time = variable

    Time value to be generated by photo sensor trigger.

    An example of a "correct" value would be for the time value of 23.309,
    the speed would be approx. 168

    can anyone think of a way to do this?
    Oh yeah, two other things. The photo sensor "cue" starts and end the
    timing cycle, the value is generated from this duration. A new cycle is
    stated from the end of the last cycle. 2- A manual reset via momentary
    switch.
     


  15. Why no PICs? What you ask can be done with standard ICs, but it will be
    bigger in size and probably more expensive than a single-chip PIC solution.
    And PICs are easy to get anyway. To do it with discretes you'll need some
    sort of counter to count with a given frequency that is determined by the
    time-to-speed relationship, then some 7-segment driving chips to drive the
    displays and some logic gates and/or flip-flops to reset/start/stop the
    counter at the trigger times, etc. With a PIC it will all be in a single
    teeny-weeny little IC (including the 7-segment driving). Plus you'll be able
    to update/change the design by simply reprogramming it.

    I'd go for the PIC...

    Costas
     
  16. Jim Large

    Jim Large Guest

    Looks like another homework assignment to me.

    -- Jim L.
     
  17. No, I think he is actually trying to build something. He wants to do a speed
    measurement system. The 'No PIC' requirement was simply due to unfamiliarity
    with the technology, I believe.

    Doing a display using 7 segments is easy with a microcontroller such as a
    PIC, using 3 wires. Its a matter of shifting the data you want into a set of
    cascaded shift registers.

    Without uCs, there are specialized chips such as the 74247 that can be used
    to translate the output of BCD counters into the input required for 7
    segment displays.

    Regards,
    Bob Monsen
     


  18. Why the need for shift registers? I think just a PIC can do everything. Just
    use 10 wires (3 for the common cathodes/anodes and 7 for the segment bus).
    The code to transfer the data bit-by-bit to the shift registers will
    probably be more difficult for him than doing a display refresh routine
    (just send the digit data to PORTB and pulse the corresponding common a/c
    for some small amount of time, do the same for the other two). Plus you save
    the shift register ICs (at the expense of a somewhat dimmer, but very
    acceptable, display).

    cheers,
    Costas
     
  19. On a uController, the pins are at a premium. I usually use a PIC12F675 which
    has 8 pins, two of which are power pins... Thus, even three pins are alot.
    There are schemes that use a single pin to do this, but the
    software/hardware support is actually somewhat complex to do it, relying on
    frequency encoding the commands.

    The code for this is actually quite simple, about 10 lines of assembly code,
    and a few lines in the eeprom for storing the 7 segment encodings. If you
    are curious, I can post it...

    Another nice thing is that you don't have to refresh the display using this
    technique, which simplifies the software main loop.

    Regards,
    Bob Monsen
     


  20. The lack of refreshing is probably the biggest benefit of the shift register
    approach, as the LEDs will be at their brightest and you don't have to take
    care of the timing in code. But this requires the PIC, plus the shift
    register ICs. For the refresh method, a single 18-pin PIC (= 1 IC) and three
    transistors are all that's needed. I prefer the 1 IC approach, but either
    way is OK and definitely better than not using an MCU at all.

    cheers,
    Costas
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-