![]() |
Analog potentiometer to counter
I'm trying to connect an analog pot to a counter to keep track of how many revolutions the pot has made. There are a just a few examples of this. Can anybody look at this class and see if there are obvious errors? I know AnalogTriggerOutput isn't the most tested code path.
getturns() currently doesn't return anything but zero. I want it to increase on a clockwise revolution and decrease on a counterclockwise revolution. Code:
#include "AnalogChannelVolt.h"4143 |
Re: Analog potentiometer to counter
I haven't played with Analog triggers for a few years, and that was in LabVIEW. I just pulled up my old LabVIEW code and it looks very similar to yours.
Are you sure the pot value is getting below 0.5v and above 4.5v? If it isn't the Analog Trigger won't trigger. It may also be usefull to look at the AnalogTrigger getInWindow and getTriggerState values, to see if it is the Analog Trigger that isn't triggering, or the counter that isn't counting. |
Re: Analog potentiometer to counter
The analog voltage goes between .2 and 4.8v. I can see getinwindow change state once a rotation. I'm going to try just using the upsource just to see what happens. The FPGA code is not released, correct?
|
Re: Analog potentiometer to counter
changing
Code:
m_count->SetUpSource(m_trig, AnalogTriggerOutput::kRisingPulse);Code:
m_count->SetUpSource(m_trig, AnalogTriggerOutput::kState);I think AnalogTriggerOutput::kRisingPulse is implemented in the FPGA which I can't see inside. |
Re: Analog potentiometer to counter
Quote:
|
Re: Analog potentiometer to counter
Quote:
|
Re: Analog potentiometer to counter
I'm making progress. I does look like the signal does not transition fast enough to completely jump the window.
One other question, Is there a maximum number of AnalogTriggers available in the FPGA? I tried hooking up two AnalogTriggers (with different windows) to the same channel and that seems to work. |
Re: Analog potentiometer to counter
The documentation for the LV VIs state that you have eight analog triggers.
Greg McKaskle |
Re: Analog potentiometer to counter
I finally got the AnalogTriggers working well counting rotations.
I was using these pots: http://www.mouser.com/ProductDetail/...1hvDsngmWGdg== The key was reducing the sample rate to 1000 Hz. Code:
this->GetModule()->SetSampleRate(1000);At the max rpm of the sensor (500 rpm) that is still 120 samples per rev. I tested two implementations. Both worked fine. One used the rising/falling pulse feature to catch the rollover. The other used two AnalogTriggers to convert the pot to a quadrature signal. That was fed into an Encoder object. Code is here: https://github.com/FRC-Team-4143/TMW...hannelVolt.cpp |
Re: Analog potentiometer to counter
Quote:
|
Re: Analog potentiometer to counter
Quote:
|
| All times are GMT -5. The time now is 12:53. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi