Help with PE Lab "MonitorPWM" object
Tired2
Posts: 29
Hi,
I am new to the propeller, and have a question about modifying the "MonitorPWM" object from the Propeller Education Kit (#7 Counter Modules)
My project involves running a large DC motor with a PWM output... I have the driver circuit in place, and everything is functioning as it should.
I have implemented a few safeties that should keep me from having a 'runaway' motor in the event of a drive circuit failure (transistor burning up in the ON position, etc)... Once a value goes out of spec (for instance temperature of the motor or drive transistor), the main safety function will set the throttle to 0% Duty, and open a relay that disables the drive system. Anyway, that is all working well, so on to my problem:
I would like to use a voltage divider circuit to monitor PWM duty at the motor, and if the PWM duty at the motor does not match the PWM duty that is being generated (within a few percent), then I want to go to error. (I'm also not yet sure how to get the 24v motor voltage to the propeller's counter pins, but that is another story... maybe voltage divider?) For now, I have soldered my output pin directly to my input pin for testing.
Using the MonitorPWM object (attached for convenience) works well... I get a PWM input within 1% of my output across the 0-100% duty cycle. The problem is that when I get to 100% duty cycle, it no longer detects edges, and the value remains at the last valid reading (1%-99%). Depending on how fast I ramp the throttle, the value can be as low as 85%, and the "tHprobe" variable set by "MonitorPWM" will remain there until I return the throttle to 99% and it detects a new time.
Is there a simple way around this problem? Obviously, it happens on the way down to 0% as well, which is also a problem.
For those who know spin better than I do, is there a way I can modify 'MonitorPWM' to set the value to 0 if waitpeq does not find an edge? Maybe a simple check to see if the pin is high over X amount of cycles?
My current PWM frequency is at 1.5KHz.
Thanks in advance for any suggestions.
I am new to the propeller, and have a question about modifying the "MonitorPWM" object from the Propeller Education Kit (#7 Counter Modules)
My project involves running a large DC motor with a PWM output... I have the driver circuit in place, and everything is functioning as it should.
I have implemented a few safeties that should keep me from having a 'runaway' motor in the event of a drive circuit failure (transistor burning up in the ON position, etc)... Once a value goes out of spec (for instance temperature of the motor or drive transistor), the main safety function will set the throttle to 0% Duty, and open a relay that disables the drive system. Anyway, that is all working well, so on to my problem:
I would like to use a voltage divider circuit to monitor PWM duty at the motor, and if the PWM duty at the motor does not match the PWM duty that is being generated (within a few percent), then I want to go to error. (I'm also not yet sure how to get the 24v motor voltage to the propeller's counter pins, but that is another story... maybe voltage divider?) For now, I have soldered my output pin directly to my input pin for testing.
Using the MonitorPWM object (attached for convenience) works well... I get a PWM input within 1% of my output across the 0-100% duty cycle. The problem is that when I get to 100% duty cycle, it no longer detects edges, and the value remains at the last valid reading (1%-99%). Depending on how fast I ramp the throttle, the value can be as low as 85%, and the "tHprobe" variable set by "MonitorPWM" will remain there until I return the throttle to 99% and it detects a new time.
Is there a simple way around this problem? Obviously, it happens on the way down to 0% as well, which is also a problem.
For those who know spin better than I do, is there a way I can modify 'MonitorPWM' to set the value to 0 if waitpeq does not find an edge? Maybe a simple check to see if the pin is high over X amount of cycles?
My current PWM frequency is at 1.5KHz.
Thanks in advance for any suggestions.
Comments