555 Astable timer integration to MCU pic18f4550 need help..

Thread Starter

daiza

Joined Dec 18, 2012
15
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.
 

tshuck

Joined Oct 18, 2012
3,534
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?
 

Thread Starter

daiza

Joined Dec 18, 2012
15
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
 

tshuck

Joined Oct 18, 2012
3,534
Use a proper crystal oscillator, you'll get no such accuracy from an astable 555; the frequency will vary widely with temperature.
 

BillO

Joined Nov 24, 2008
990
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.
 

tshuck

Joined Oct 18, 2012
3,534
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...
 

ErnieM

Joined Apr 24, 2011
8,053
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
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.
 

Thread Starter

daiza

Joined Dec 18, 2012
15
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.
 

ErnieM

Joined Apr 24, 2011
8,053
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..
 

Thread Starter

daiza

Joined Dec 18, 2012
15
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!
 

ErnieM

Joined Apr 24, 2011
8,053
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.
 

Potato Pudding

Joined Jun 11, 2010
688
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.
 

Potato Pudding

Joined Jun 11, 2010
688
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.
 

ErnieM

Joined Apr 24, 2011
8,053
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. ;)
 

Thread Starter

daiza

Joined Dec 18, 2012
15
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!
 

ErnieM

Joined Apr 24, 2011
8,053
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.
 

Thread Starter

daiza

Joined Dec 18, 2012
15
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.
 

Thread Starter

daiza

Joined Dec 18, 2012
15
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!
 
Top