Continue to Site

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.

  • 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.

Clock

Status
Not open for further replies.
Shipping is better then it used to be. I am a bit of a tracking junkie. I love to log on to UPS or FedEx and watch as each package makes its way to my door.

Some parts of the ground shipping networks seem to be better then others about scanning the packages. At times packages show up that are still 100's of miles away according to the web site.

Some would say I need a life, and they could be right. :)
 
heh i dont find nothing wrong with that. I do the same thing. If i can track it i will. I think its more of a wanting to make sure its coming. Or better yet like watching my investment.

I get to see if a company lies like about what day they shipped it out and the time it supposed to come. When i made my first order from newark it came in about 4 days. Missing 1 part i was like wtf... then i found out it was out of stock but then they charged me $10 to ship that item out to me. I was like OMFG its not my fault it went out of stock. But the item was needed so i paid lol
 
Newark did that to me too. It was about 20 cents worth of resistors. Now I make very sure everything is in stock.

If I do not have my wires crossed Mouser will make 1 additional shipment at no cost for out of stock items.

I think Newark ships trash to its customers. In one box I recieved 3 component reels with about 100 resistors on each. They are also quite free with the packing material they have to pay for. I have seen single parts in foam lined boxes inside a bubble pack envelope. Then the entire order was encased in more bubble wrap and boxed. It often bumps shipping up to the next step. Still if I need PICs and some other parts their prices are very good.
 
hi atom,
Looking at the posted circuit, I am puzzled why you are using a S/R ic, requiring 3 PIC lines to access 4 push buttons.?

Hope you had a 'lazy' Xmas.:)
 
heh i originally had 5 buttons but it got cut down to 4. I still save a pin. But since i have to many available im going to take out the 74LS165 to reduce code size and simplify circuit. Also at least i learned how to use it :D
 
Also i noticed my alarm goes off every now and then and its not supposed to. I think i have a interrupt issue still. Since thats the only way to trigger the alarm i can rule out a lot. So i guess i have to check code anyway while changing buttons :D

Also im working on some other things right now (NON RFID related) so it will have to wait a few hours before i can check it.
 
Jason,

I haven't used an RTC chip yet. I have a couple DS1307 samples but just never tried them.

One thing I wondered about though... How would I use the RTC chip. I imagined that I would read the time and date from the chip during power up into variables and then simply 'bump' them during a 1 Hz interrupt from the DS1307 "SQW" output. And so I would maintain Alarm, Timer, Calendar, and Clock variables (and logic) in my program. Some other examples I've seen simply read the DS1307 chip over and over again.

Maybe I'll hook up one of the DS1307 chips to play with...

Mike
 
Jason,

I haven't used an RTC chip yet. I have a couple DS1307 samples but just never tried them.

One thing I wondered about though... How would I use the RTC chip. I imagined that I would read the time and date from the chip during power up into variables and then simply 'bump' them during a 1 Hz interrupt from the DS1307 "SQW" output. And so I would maintain Alarm, Timer, Calendar, and Clock variables (and logic) in my program. Some other examples I've seen simply read the DS1307 chip over and over again.

Maybe I'll hook up one of the DS1307 chips to play with...

Mike

hi Mike,
I program the DS1307 to give the 1Hz output on pin7, connect this PB.0 to give a 1sec interrupt.
On interrupt it reads the date/time.
There is 'spare' 56*8 ram on the DS1307 for the vars.
The battery I use is the CN 1/2AA 3V lithium.
 
heh i originally had 5 buttons but it got cut down to 4. I still save a pin. But since i have to many available im going to take out the 74LS165 to reduce code size and simplify circuit. Also at least i learned how to use it :D

hi,
Understood.
One ic that you could look over for future use is the HEF4532.
 
Thanks ill gather info on it now MIKE can i borrow that idea? Meaning to use the 1hz interrup to trigger a read and show data. It would be nice. But then how would i figure in the alarm?

I would have to rewrite port usage so it uses the INT0 and INT1 from the pic for Alarm and 1Hz. Right now i use them for 74ls165 anyway so i can remove it to use for the other alarm and 1hz...

wow i love this thread so many great thoughts...
Ill write something in a few hours and ill post here and hopefully it will satisfy my curiosity and match your thoughts.

EDIT:
Eric the "HEF4532" looks like a nice IC to own. I might get a few to play with. I never seen a IC like this. "8-input priority encoder"
 
Last edited:
hi Mike,
I program the DS1307 to give the 1Hz output on pin7, connect this PB.0 to give a 1sec interrupt.
On interrupt it reads the date/time.
There is 'spare' 56*8 ram on the DS1307 for the vars.
The battery I use is the CN 1/2AA 3V lithium.

Hi Eric,

Just wondering why you would read date & time on every 1 second interrupt?

Mike
 
This way you dont read it more than you have to i assume and you can handle other things faster. Its less loading and i assume takes less power also.

Every second it gets a interrupt and from there reads the RTC and then displays data on LCD. Thats how im going to have it. Right now i have it just reading as fast as possible which causes issue when going through the menu. Also if something takes long i dont have to worry since its a interrup it will jump out update data and jump back.

Im sure i can disable the Interrupts while in menu then re-enable them when finished.
 
im lost now. I changed alot and running through hundreds of lines is a hassle. I think i messed up interrupt put not sure. Can someone spot something while i check some more. 2 heads are better than one i think(as long as they are not on same body of course)
 

Attachments

  • main.c
    25.7 KB · Views: 134
What happens when the years run out? Does the year simply roll over while the time continues to operate correctly? Hopefully no Y2K-like nonsense.

I was amused to see that (some of?) the 24F PICs have a built-in RTC. I just received an Explorer 16 board, the 24F chip came preprogrammed with some calendar firmware. Overall the 24F seems no more difficult to use than an 18F (apart from the 24F's awkward package - for which there are adapter PCBs) and the built-in RTC reduces cost, frees up serial pins etc. I'm not trying to make a point, just thought I'd bring it up.
 
Thanks ill gather info on it now MIKE can i borrow that idea? Meaning to use the 1hz interrup to trigger a read and show data. It would be nice. But then how would i figure in the alarm?

The thing is I don't think I would read data from the RTC each 1 second interrupt. Instead I would just use my existing Clock / Calendar / Alarm / Timer code but synchronize it to the RTC 1 second interrupt. This provides a fully functioning system that will work with almost any 1 second heartbeat source.

As for the Alarm function, I just compare ALMHRS and ALMMIN to CLKHRS and CLKMIN as one of my my once-per-second functions.

Mike
 
What happens when the years run out? Does the year simply roll over while the time continues to operate correctly?

My guess would be that the year will roll over and the time will continue to operate.

However, according to the datasheet the DS1307 only has leap year corrections up to 2100, so months and days of the month will probably go wrong after 28 February 2100 (because 2100 is a leap year and 2000 wasn't).
 
Mike so your saying just use that output of 1hz to count and stuff.

That would eliminate the whole 2100 year issue and all BCD problems completely. Since i would be writing the code myself. Which means i wouldnt even have to use the RTC SPI lines besides having to program the 1hz to operational. Thats pretty cool idea. I have another 1306 Ill play with that idea on another pic. I have another LCD and some more sn74LS164's so ill be good to make another and try it out.
 
Status
Not open for further replies.

Latest threads

Back
Top