count & divide by 14

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
mel
Posts: 9
Joined: Tue Dec 12, 2006 4:11 pm
Location: UK
Contact:

count & divide by 14

Post by mel »

Hello Everyone.

I am a relative beginner with pics and flowcode, and have a problem, that I am not sure that I can solve using flowcode, so forgive me if this is a stupid question.
I am using a Pic 16f628A at the moment to generate a 30 minute delay. Is it possible ( using flowcode) to use the same Pic 16F628A whilst it is in the delay mode, to apply square wave pulses from an external 555 timer ic (approximately 40Khz) to an input on the PIC, then divide this x14 within the 16f628A (the same as you would do if you was to use a CMOS 4060 ic) and to use the divided output to flash an LED on any other output. I have a lack of space issue with my project, so I am trying to keep the component count down, and cannot use a 4060 for lack of room.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: count & divide by 14

Post by Sean »

Hello,

It should be possible to add a simple frequency divider function to an existing program on a PIC16F628A.

It will need to operate from RB0/INT interrupt input (from the 555) but can use any spare pin as its output.

The interrupt can be configured to trigger from a selected edge of the input signal.

If the interrupt handler macro increments a count variable every time it is triggered, and clears the counter and toggles the output pin every 7th time, this will provide division by 14.

At 40KHz, the interrupt code will obviously be executed 40000 times every second (25us). This will probably have an affect on the timing of the main delay program - depending on how the delay is being generated. The interrupt handler will need to be kept as simple as possible, and the chip clocked as fast as possible, to keep this to a minimum.

Post Reply