View Single Post
  #12   Spotlight this post!  
Unread 16-03-2012, 20:28
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Reading an absolute encoder via PWM in C++

Quote:
Originally Posted by Ether View Post
Code:
/**
 * Set Semi-period mode on this counter.
 * Counts up on both rising and falling edges. 
 */
I didn't look at the code, but the description doesn't sound like what is needed.


Wow. The description in LabVIEW is conflicting on this.

In LabVIEW, the Create Counter is polymorphic (there are multiple versions which you can select with a drop-down box). For the Semi-Period mode, the help says this:

Code:
Open Semi Period Mode
Opens a reference to a counter and configures the counter to measure the time between pulses in a signal. You can configure the counter to measure the time between high pulses by setting High Pulse (T) to TRUE. Otherwise the counter measures time between low pulses.
But later, in the connector description, it says this (what I read and assumed it meant pulse-width):
Code:
High Pulse (T) specifies, when TRUE, that the counter measures the length of the high time of the pulse. When FALSE, the counter measures the length of the low time of the pulse.
Since Up/Down mode can also measure single-wire encoders in a similar way to what the Semi Period mode describes, and since Semi Period mode (to me) did not act correctly when the encoder's lines were not of equal width in the light and dark spaces, I am inclined to believe that the Semi-Period mode actually measures pulse width.

The LabVIEW description of Up/Down mode says this:
Code:
Open UpDown Mode
Opens a reference to a counter and configures the counter to detect pulses on the rising or falling edges of a signal. You can specify an up source and a down source but most applications require only one signal per counter. The up source increases the counter and the down source decreases the counter.
We have a non-contact optical sensor and a custom-made disc with black tape, and the tape is not the same width as the bare aluminum space (by quite a bit). In Semi Period mode, when I configure the counter correctly and scale the output to RPM's, the numbers are not the same as the tachometer. When using Up/Down mode, they match the tachometer within 2 rpm. This leads me to believe that Semi Period mode actually measures pulse width, while Up Down mode measures time between rising edges - the time between rising edges does not care if the pulse width is different high than low.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Reply With Quote