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

Newbie needs help with 'C' code.

Status
Not open for further replies.

Henrico

New Member
Hi Guys,
Firstly let me thank you for looking at this thread.
Secondly, I dont believe in re-inventing the wheel.
OK...I found a project that more or less suited my requirements here
http://chaokhun.kmitl.ac.th/~kswichit/f84rtc/f84rtc.htm. (I'm only using one port, a waste of i/o but like I said it works for me)
I'm using this controller to open and close an automated gate in a complex of 28 units, so at peak hours you can imagine the poor gate , it doesnt even get time to opn/close properly before the next person wants to enter/exit, this is working 100%.(The gate remains open from 06:45 - 08:30 and again 16:00- 17:30)
Now I have a problem on week ends, I dont want the gate to remain open for the peak periods (I now have a manual bypass switch that I activate on a Friday evening and a Sunday evening ...uuuurrrrrgghhhhh
I have tried to change the code so the unit only operates from mon-fri
to no avail. I have inserted my code as well as the original code, if one of you boffs would'nt mind having a look, (I have commented my code where I THINK I'M going wrong) a bit of advise would be greatly appreciated , as I have been trying everything "I KNOW" which is not too
much.
Once again THANKS guys, there are some real helpfull people out there.
 

Attachments

bmcculla

New Member
I'm, a little confused about what you are trying to accomplish with this:
if(day <= 5) continue; else time();

It seems to me that calling time() here will add two seconds per 1 second loop. Also its a bad idea to use the continue keyword - its poor coding style and it makes your code more difficult to follow.

Without a little more info about what the symptoms of the error are its hard to debug.


Brent
 

falleafd

New Member
I don't remember exactly, but there is a clock chip that you can read date, and time. It may works in 3 year without battery, all you have to do is reading from that chip and do what you want. The chip is used in digital chinese wall clock. Perhaps, it's helpful.

However, the gate should have manual control, because there are some unnormal vacation!!?

Long time no see you all :)) << too busy :)
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top