Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Quadrature encoder code question

Status
Not open for further replies.

yzou_ua

Member level 5
Joined
Nov 5, 2008
Messages
92
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,869
After init etc., I calculate the speed in following way. Could someone help me find anything wrong here?? Buz the measured result varies time by time(when running the motor at constant speed).

while(1)
{

if(TMR3<23000)
{
if(POS1CNT=0)
{CntsRev=0;
CntsRev+=1;}

Cnts=POS1CNT+(CntsRev-1)*MaxCnt; // The total pulse number during above time period

Speed_rad=2*3.14159*Cnts/ppr/TMR3; // Speed in rad/s
}
}
 

Is this step correct??? {CntsRev=0;
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top