How to use the timer function of a 28X1 ?

I have a program running in a 28X1 picaxe and I would also like to keep track of the number of pulses input during a 10 sec interval from input 5 can I do this? Which command do I use?
 

SD2100

New Member
Count 5,10000,w0

Using this command the program will stop on the command until the ten seconds has expired.

also look at the settimer command
 
Last edited:
Yes that is the problem the program stops

doing another function while it waits the 10 seconds to count the number of pulses. Is there any way to have the count in the background while the program is running a program? Could I use a LM555 timer and have an input every 10 seconds and have an interrupt that increments a variable to keep track of the input pulses? What is the best way to do this?

Thanks again for your help.
 

Dippy

Moderator
It would be a good idea to be more precise about your "another function" as there may be a way to code it in. Depends.... ditto an external interrupt... depends on your code and your requirement.

Alternatively, it is possible to use some kind of counter chip and then read it every 10 seconds based on the 28X1 timer. Or use a second PICAXE (eg a low cost 08) and make a programmable counter.

Many things are possibley possible maybe. It depends on your exact requirements, which are currently a little vague. Sorry.

Generally, it's always best to clearly lay out the problem with a sort of flow chart or list, maybe some psuedo-code and a schematic of any circuit.
It takes the strain off our crystal balls :) (which were a cheap bulk order from Ebay) and drip feeding information can turn a 2 page thread into 20 pages.
 

SD2100

New Member
You could use SETTIMER setup as an internal timer for 10 seconds and count external pulses with an interrupt, when the timer expires it sets the toflag so just keep checking this. I havn't got a crystal ball yet I'm still using the shovel !!!!:)
 
Ok I didn't want to overuse this forum too much

the application is to build a brushless DC motor as a class project. I have a 3" dia. disk which has (2) North pole button magnets on the outside rim, opposite each other facing down. As the disk rotates they pass over a total of (3) fixed coils equal spaced which I am controlling with the Picaxe 28x, (or could use a 28x1 if have to) using the L293D to create a north or south pole to rotate the disk. I also have 3 hall effect sensors equally spaced inbetween the coils to sense the disks position. The objectives are to:

1) rotate the disk
2) calculate the disk rpm
3) display the rpm on an lcd serial display with updates every 10 seconds


Ok thanks again for your help.

Francis
 
Last edited:
Top