555 Astable timer integration to MCU pic18f4550 need help..

Discussion in 'Embedded Systems and Microcontrollers' started by daiza, Dec 18, 2012.

  1. daiza

    Thread Starter New Member

    Dec 18, 2012
    15
    0
    Hi..im currently doing my thesis and ill be using a 555 timer to be integrated in my pic18f4550..i'm not so familiar with the integration, specifically with the analog to digital conversion (if im not mistaken)..plss help me,.thanks in advance! im using MPLAB in for the programming.
     
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    We are going to need some more information from you:

    What is the point in integrating a 555 with a uC?

    Are you trying to use it as a clock source?

    Are you trying to measure the rise/fall times of the signal?

    Finally, what are you trying to do? I know, I know, you are trying to integrate a 555 with a PIC, but to what end?
     
  3. daiza

    Thread Starter New Member

    Dec 18, 2012
    15
    0
    yes, im using it as a clock source,.i just need the mcu to count each signal that the 555 timer produces,.will it be possible if i use the 555 timer to count up to 24hrs?..my thesis is an overload detection for medium sized boats and i need to detect an specific time in order for my device to start its detection..thanks
     
  4. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Use a proper crystal oscillator, you'll get no such accuracy from an astable 555; the frequency will vary widely with temperature.
     
    daiza likes this.
  5. daiza

    Thread Starter New Member

    Dec 18, 2012
    15
    0
    ok..thanks! ill update again about my progress.thank u!
     
  6. BillO

    Well-Known Member

    Nov 24, 2008
    985
    136
    Why not use a proper real-time clock? The DS1307 costs less than $3 for it and all the support parts and is designed to interface easily with a MCU and provide a very accurate time source.
     
    daiza likes this.
  7. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Yes, Bill is absolutely correct...I thought the OP needed a clock source and didn't realize that he needed specific time information, I needed to read the whole paragraph. Since this is the case, use an internal oscillator and run a real-time clock to do time checking...Most RTCs have a an alarm function allowing precisely timed measurements...
     
    daiza likes this.
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    A RTC is a good choice to know the current time. There are several excellent units on the market that are incredibly accurate as they have the timing crystal inside the chip, they even monitor and correct for temperature variations, and by adding an external coin cell they are simply to keep time without system power applied. My current choice is the PCF2129A as it is less expensive then other devices, and if anyone knows of something cheaper I would like to know.

    That gets the time stamp part done. Now about that "overload" issue. Are you monitoring current? There are some very good high side current sensing chips that convert a shunt voltage in the positive leg to a ground reference voltage that most and A2D can convert. Exactly which one to use (as there are many) would depend on exactly what accuracy & range is being measured.

    Finally there is the output. Is this a simple display device, a data logger, or something more exotic like a USB device to allow reading to be collected by a PC? Any and all options are quite possible and do-able.
     
    daiza likes this.
  9. daiza

    Thread Starter New Member

    Dec 18, 2012
    15
    0
    Thank you very much for your suggestions! i really appreciate it! ok then ill give it a try with the RTC..i was already planning to use it but my teacher said that it is hard to integrate this rtc with the mcu?? so i decided to use a simple 555 timer..i was not so familiar with RTC so i dont have any idea..what i knew was the built in clock inside the mcu,but it is very hard to configure..so ill give it a try with the RTC..thanks for suggestiions! Appreciate much! ill update again soon.
     
  10. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    The RTC I suggested can work over either an SPI or I2C interface. I prefer I2C as it needs 1 less pin (2 total), though both ways are supported by the PIC.

    A RTC can also drive another line for an interrupt at some rate, I use 1 per second, so the PIC can keep track of the current time..
     
    daiza likes this.
  11. daiza

    Thread Starter New Member

    Dec 18, 2012
    15
    0
    Thank you very much! The RTC i ordered was the one bill0 suggested, the DS1307..i wasn't able to find PCF2129A here in the philippines..im a filipino by the way. Thanks a lot ErnieM!
     
  12. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    The DS1307 is OK, but you need to add an external 32.768kHz crystal to it, and for many reasons it may not be accurate as units with the crystal built inside it. But it's been the industry standard for a long time now.

    Would this link help for parts? http://www.digikey.ph/

    They are my go-to source here in the USA.
     
  13. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
    PIC18F27J53

    PICs come with built in Real Time Clock and Calendar.

    If you are going to learn to develop with PICs be aware that there is probably a PIC that does 100% of the needed peripherals for better than 90% of projects.

    The right Microchip controller part is probably out there and it can eliminate most of your project's hardware development, while very likely costing less than a long list of parts. You can develop faster and more reliably.

    Pick your requirements before you pick your PIC.
     
  14. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Yes they do. And it's a terrible implementation to be almost useless. The lack of any provision for alternate power to maintain the timekeeping function is a huge drawback to any serious consideration for use.
     
    absf likes this.
  15. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
    Fair enough, there can be advantages to using a separate RTC device.

    Forcing deep sleep when main power is lost and layering a backup button cell into the power circuitry is how I would provide for that lack of provision, but adding a separate device with its own button cell can make things more modular and much easier to troubleshoot.

    I shouldn't have confused the issue. I apologize for interjecting an irrelevant opinion.
     
  16. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    This is one of those "let's spitball ideas" thread so I don't think it's too off point as there is no real issue to confuse. ;)
     
  17. daiza

    Thread Starter New Member

    Dec 18, 2012
    15
    0
    Hey there! I already used a ds1307 which you have suggested. but i find it quite hard interfacing it in the pic18f4550 especially the part where i had to display its output time in a LCD.I'm currently using MikroC pro in programming my project. I'm confused with the coding. hope anyone could help me..thanks again!
     
  18. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Well you have multiple tasks here to get working:

    DS1307 up and running
    I2C to the DS1307 (resistors for the hardware and software)
    LCD hardware (just some wires, plus usually a pot for contrast)

    I usually get each part of this working, then marry them together. That means I can get the LCD to show me "HELLO WORLD" and I can see the current time from the DS 1307 in the debugger.

    Then some routines to translate the 1307's time numbers to strings... there you go.

    I'm not a MikroC user so you'll have to search out prior art yourself. I have no links to share.
     
    daiza likes this.
  19. daiza

    Thread Starter New Member

    Dec 18, 2012
    15
    0
    Thank you very much for your help..ok i'll do what u say..i hope i could make it work this time! :) by the way what software do u use in programming pic's? i also use mplab ide. Thanks again for the advice..really helpful.
     
  20. daiza

    Thread Starter New Member

    Dec 18, 2012
    15
    0
    I'll update again with my project..well.,i hope i'll be able to make it work this time..thanks again ErnieM for the help!
     
Loading...