Go Down

### Topic: franks arduino post about electronic gates (Read 1 time)previous topic - next topic

#### FrankinAround

##### Feb 08, 2011, 06:23 pm
Hi. Im trying to build a digital clock. Radio shack didnt have the ic's that i needed though.  So i was wondering if i could just make my arduino replace them it would be cool. Im new to arduino though and also to electronic gates. So can anyone help me turn my arduino into some different gates like. Nand nor and or ect. The project is here if interested : http://electronics.howstuffworks.com/gadgets/clocks-watches/digital-clock.htm

#### baum

#1
##### Feb 10, 2011, 09:39 pm
Yep.
Code: [Select]
`x && y`
where x and y are your 2 inputs will function just like a logic gate. Couldn't find the circuit, though... Can you please point us to it?

#### westfw

#2
##### Feb 11, 2011, 07:45 am
I'm not sure how to interpret your question.

Yes, you can build a digital clock using an Arduino.  It would (or could) share a lot of principles with the article your reference.  Essentially, you could replace each chip with a software subroutine:
Code: [Select]
`void tick()/* Execute this function every time we see a one-second clock tick */   seconds = seconds + 1;   // count seconds like a 7490.   if (seconds >= 10) {  // counter reached limit?      seconds = 0;  // wrap      tenseconds = tenseconds + 1;  // count 10s of seconds like a 7490      if (tenseconds > 6) { // divide by 6         tenseconds = 0;  // wrap         minutes = minutes + 1 ;   // count minutes like a 7490       // etc       }   }   // We have the time in the appropriate digit variables.   // convert to displayable form for 7-segment displays   digit0 = digit2segments[seconds];   digit1 = digit2segments[tenseconds];   digit3 = digit2segments[minutes];   // etc.   updateDisplays();   // actually send out signals t the displays}`

No, you can't replace a handful of 7490s and 7447s with an Arduino directly; to start with there just aren't enough pins.

Go Up