PDA

View Full Version : One Shot Rising



MarcBergeron
- 27th September 2009, 21:06
Hi everyone,

I have a clock DS1307 and i need to move a stepper motor at each seconds. I would like at add a ONE SHOT RISING or something similar so that my chip (16f877a) doesnt repeat the motor step more than once every second. My problem at the moment is that my chip reads the instruction more than once every second.

Any idea if a function is available with microcode studio plus or any idea how to create a ONE SHOT RISING. I would like my chip to create only one event only when my value changes .

Thanks

Darrel Taylor
- 27th September 2009, 21:55
Connect the 1307's SQW/OUT pin to the 877A's RB0/INT pin.
From the picture, it looks like you'll need to move the SDA line to another pin.

Set up the 1307 to output a 1Hz square wave output by setting BIT4 of the 1307's CONTROL register, with bits 0 and 1 both cleared (0).

Then the INTF bit (INTCON.1) will be set on each Rising edge of the SQW signal.

Then you can clear the flag (INTCON.1 = 0) and it will not be set again until the next rising edge, 1 second later.

Interrupts not required.