View Single Post
  #3   Spotlight this post!  
Unread 09-05-2016, 17:36
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Continuous Feedback Sensor on CANTalon


Or in native units do this:
Code:

double P=200;
double T=1000;
double SetPoint;

void main(void){
SetPoint  = T - 1024*floor(0.5+(T-P)/1024);
printf("P=%f  T=%f   SetPoint=%f \n",P,T,SetPoint);
}
Output:
Code:
P=200.000000  T=1000.000000   SetPoint=-24.000000
If the sensor goes from 0 to 1023, then you have to go backward 224 steps (not 223) from 200 to get to 1000.

(Because 0 is equivalent to 1024, just as 0 is equivalent to 360 degrees).



Last edited by Ether : 09-05-2016 at 18:08.
Reply With Quote