Using the PWMPAL to count...
Marc S
Posts: 2
I am new to the "Stamp" world...
Has anyone used the PWMPAL to count pulses from say a turbine flowmeter?·
My intent is to use the PWMPAL to count a 200Hz signal coming from a turbine flowmeter, for approximately 120 seconds at a time (filling a container (count fluid into contaner) then wait until fluid is consumed, then refill ...).· I would then like to apply a K-factor to convert counts to gallons then add this to my stack to maintain a "total fluid consumed" by the rig.
To complicate things, I was hoping to use this with the PLC Stamp module.· As I see it, I would have to declare one of my digital outputs (P8) as a counter·input then wire my turbine flowmeter to this "Input".· What I don't like about this is, I'm wiring and "Input" to an "Output" as defined by the silk-screening on the PLC housing.
Has anyone else tried this, or does anyone·have a better solution?
I'm doing some limited "rig" process control as well with this device, so I don't think I can just use a standard digital input and count for 2 minutes.
Any help would be appreciated.
Has anyone used the PWMPAL to count pulses from say a turbine flowmeter?·
My intent is to use the PWMPAL to count a 200Hz signal coming from a turbine flowmeter, for approximately 120 seconds at a time (filling a container (count fluid into contaner) then wait until fluid is consumed, then refill ...).· I would then like to apply a K-factor to convert counts to gallons then add this to my stack to maintain a "total fluid consumed" by the rig.
To complicate things, I was hoping to use this with the PLC Stamp module.· As I see it, I would have to declare one of my digital outputs (P8) as a counter·input then wire my turbine flowmeter to this "Input".· What I don't like about this is, I'm wiring and "Input" to an "Output" as defined by the silk-screening on the PLC housing.
Has anyone else tried this, or does anyone·have a better solution?
I'm doing some limited "rig" process control as well with this device, so I don't think I can just use a standard digital input and count for 2 minutes.
Any help would be appreciated.
Comments
I THINK I see what you're trying to accomplish here. See if this makes sense.
The flow-meter OUTPUT will be INPUT to the PWMPAL, NOT an INPUT to the Stamp PLC. A Stamp PLC INPUT will retrieve the necessary counts from the PWMPAL OUTPUT. Any further OUTPUT (data display, etc) will come from a Stamp PLC OUTPUT.
I think that's it
As far as the counting frequency is concerned, I extrapolated from other information in the PWMPAL documentation that the maximum frequency should be at least 20 KHz. I stand to be corrected by someone more knowledgeable from Parallax, but I think that's correct.
The wait times, resetting of counters, etc on the PWMPAL are just a matter of being able to send the serial data commands to the PWMPAL in a timely manner. I would use the highest baud rate that you can use on the Stamp PLC. Unfortunately I've never used the Stamp PLC, so I can't be of more help in that area.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Genius is one percent inspiration and ninety-nine percent perspiration."
Thomas Alva Edison
Post Edited (Bruce Bates) : 2/25/2008 10:13:50 PM GMT
Thanks for your reply.
The PWMPAL module mounts directly under the BS2e in the Stamp PLC module.· So, yes, the output of the turbine flow meter will be an input to the PWMPAL module (Counter 1, Let's say) but that pin on the PWMPAL module coincides with an output on the·Stamp PLC package (DOUT 8).· Does that make sense?·
I think I can work around it by NOT declaring P8 as an OUTPUT in the code.· It just muddies the water with respect to labeling on the Stamp PLC package.· I will just use a Brady Label to cover up >>DOUT 8<< and make it >>CNT1 IN<<.
Thanks,
Marc
It makes perfect sense. I don't think I've ever seen a PWMPAL used as you are using it, with a Stamp PLC. Don't get me wrong, there should be no problem in doing so, except as you mentioned about the labelling.
I'm sorry I don't have a better answer, but perhaps someone from Parallax can chime in.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Genius is one percent inspiration and ninety-nine percent perspiration."
Thomas Alva Edison