1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Question regarding this PIC16F628 tachometer schematic…

Discussion in 'Microcontrollers' started by mbu, Feb 12, 2007.

  1. mbu

    mbu New Member

    Joined:
    Feb 7, 2007
    Messages:
    58
    Likes:
    0
    Location:
    Utah, USA
    Just leaning about PIC’s so my question might be way off base!

    [​IMG]

    In the above schematic it appears that the circuit contains a 10 Mhz oscillator. If that is correct, is the reason it is there because the designer felt that the internal oscillator of the PIC16F628 was not adequate?

    Now assuming what I stated above is correct, could that oscillator be left out and the PIC16F628 be replaced by perhaps the PIC16F628A, which has to my understanding a 20 Mhz internal oscillator?

    Thanks…
     
  2. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    The schematic indicates a crystal oscillator, so it's probably for accuracy/stability. The internal oscillator of a PIC is very temperature and voltage dependent. In order to determine if the internal oscillator is appropriate for your particular design you need to figure out what frequency the clock would have at it's lowest and highest VCC and temperature points and determine what effect that would have on the tach's output, and if the variation is acceptable. Using a higher frequency internal oscillator is only going to compound the problem even more so. When using the internal RC you're going to want to set it to the lowest possible frequency that still allows you to read the tach input at it's highest frequency components.
     
  3. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,011
    Likes:
    317
    Location:
    Brisbane Australia
    Both the 628 and 628A have internal 4MHz oscillators. This should be adequate if the incoming frequency is not too high. You could change it for a 16F88 which has a 8MHz int osc.

    Mike.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. mbu

    mbu New Member

    Joined:
    Feb 7, 2007
    Messages:
    58
    Likes:
    0
    Location:
    Utah, USA

    Thanks guys for the reply!
     
  6. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    Just a note though... There's no current limiting resistors shown on the LED display, this is bad practice especially at 5 volts as it will stress out the PIC's port drivers, and heat the chip some. It's typical to use a transistor on at least the common lines to prevent excessive PIC current draw/heating. That might be why the circuit uses a crystal oscillator.
     
  7. mbu

    mbu New Member

    Joined:
    Feb 7, 2007
    Messages:
    58
    Likes:
    0
    Location:
    Utah, USA
    Sceadwian,

    In your opinion, is the circuit okay the way it is or should I add the transistor? If the transistor is needed, would you tell me what transistor to use and how it should be incorporated into the circuit?

    Thanks...

    Mike
     
  8. fever

    fever New Member

    Joined:
    Mar 5, 2005
    Messages:
    132
    Likes:
    0
    but in that site(josepino.com) people seems to be satisfied with it.they said its working with out any issue.
    so is it ok to built as its is,or do u suggest any modifications .
     
  9. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    The only thing I can suggest without a lot of circuit redesign is placeing a current limiting resistor on the anode lines (1 2 17 and 18) experiment with a few values to determine the lowest brightness level that you find acceptable, probably between 100ohms and 1k. It'll reduce over all power consumtion and avoid any possibility of stress on the I/O lines over time.
    As is the circuit will work fine, with a little bit of limiting it'll last a lifetime though.
     
  10. donniedj

    donniedj Banned

    Joined:
    Jan 16, 2004
    Messages:
    336
    Likes:
    3
    Location:
    So Cal
    Never seen the code but most likely the LEDs are pulse width modulated directly hence the lack of resistors. There is some PWMing going on indirectly because the LEDs are multiplexed. The internal oscillator is good for all voltage ranges but may change for difference temps. For practical purrposes using a Xtal in todays high quality PICs is a waste of money, board space, and I/O lines.
     
  11. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,212
    Likes:
    640
    Location:
    Derbyshire, UK
    ONLINE
    No, it's just relying on the I/O ports being difficult to damage, they will self limit to a certain extent, so it's not like you're placing the LED's directly across 5V. However, placing current limiting resistors in series with the LED's would be a MUCH nicer way to do it.
     
  12. fever

    fever New Member

    Joined:
    Mar 5, 2005
    Messages:
    132
    Likes:
    0
    thanks i'll surely do that.

    *has any one made layout(eagle) for this ckt.if yes pls do share
     
  13. fever

    fever New Member

    Joined:
    Mar 5, 2005
    Messages:
    132
    Likes:
    0
    well i built it on bread board (http://www.josepino.com/pic_projects/index?tachometer2.jpc .but its not working well.mistakes that i felt are
    1.i used PIC16f628A instead of PIC16f628
    2.may be board connections were loose
    3.programmer (its working fine.iam using multi pic prog)
    4.iam using this type of 7-segment display(common anode) http://www.neonixie.com/store/images/HP-LED-7-SEGMENT-HDSP-5301.jpg

    so i shorted all A's to G's(dp too) together and connected them to the respective ports.and common anode of each segment will connect to the PIC port as per circuit. http://www.josepino.com/pic_projects/tachometer/JP6283II.gif

    can u help me guys.am i doing right?
     
  14. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    Maybe this is just me mouthing off, I do not understand why there is no source code. Counting pulses is not rocket science.

    Mondo Technology has a circuit called the super probe. It has 17 functions. One of them is a frequency counter. A frequency counter is pulses per second, a tach is pulses per minute. Should not be difficult to adapt it. He provides source code. It uses a 16F870.
     
  15. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,212
    Likes:
    640
    Location:
    Derbyshire, UK
    ONLINE
    It's not really a problem, WinPicProg will disassemble it - he just needs to change the config fuse settings for a 16F628A.
     
  16. fever

    fever New Member

    Joined:
    Mar 5, 2005
    Messages:
    132
    Likes:
    0
    you mean these settings
    PIC: 16F628
    CONFIG: XT osc, PWRT ON, MCRL OFF, BODEN OFF, WD OFF
     
  17. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,212
    Likes:
    640
    Location:
    Derbyshire, UK
    ONLINE
    Yes, you should be able to just set them in the programmer software as well - but the 628 and 628A use different numeric values for them.
     
  18. fever

    fever New Member

    Joined:
    Mar 5, 2005
    Messages:
    132
    Likes:
    0
    when i choose the device as PIC 16f628A and loaded the HEX (which is for 16F628) the software loading same settings.(i tried on picprog4u,ICprog,Winpic etc).imean
    PIC: 16F628
    CONFIG: XT osc, PWRT ON, MCRL OFF, BODEN OFF, WD OFF

    still no use.all the LED's in the display just switching on and staying like that.

    iam using code from http://www.josepino.com/pic_projects/index?tachometer2.jpc

    and using multi pic programmer v5.2 for programming.
     
  19. bananasiong

    bananasiong New Member

    Joined:
    Mar 7, 2006
    Messages:
    1,893
    Likes:
    7
    Location:
    Malaysia
    You can disassembler the hex file and edit it and compile again with MPLAB. But if you load 628 file into a 628A, I'm not sure whether it is working or not, I use the correct one all the time.
     
  20. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    My point is you should not have to. If you are going to make the project public provide the source code.
     
  21. fever

    fever New Member

    Joined:
    Mar 5, 2005
    Messages:
    132
    Likes:
    0
    at last its working.
    its my mistake i built it on breadboard,so usually some loose connections.
    circuit is ok.i used 16F628A only with same code.but i don't think w can use it for automotive applications.(i want to used inductive pickup method to measure the RPM).the code is quite sensitive(giving unstable readings)
    so any more ideas for this circuit guys.
     

Share This Page