微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > Help for encoder counting for PID

Help for encoder counting for PID

时间:03-31 整理:3721RD 点击:
I m doing a PID tuning. First I defined constant error and try to tune the PID. I input the angle of 40 degrees and got the difference between encoder reading angle and 40 degrees as error in my program. I want to ensure my encorder pulses reading is correct or not, and if not please help me. I used RB4-7 interrupts.

I use MikroC language, PIC 16f877, Pololu Encoder motor.

encoder motor information. It gives 64 pulses per one "motor revolution" and gear ratio is 50:1. Then it gives 3200 pulses per one revolution of "gear box shaft".
Pololu - 50:1 Metal Gearmotor 37Dx54L mm with 64 CPR Encoder

Please help me

Here is my encoder reading code

Code:
void interrupt ()
{
     if(portb.f7==1)         //if channel A start first cnt add
     {
     cnt++;
     }
     if(portb.f6==1)        //if channel B start first cnt decreace
     {
     cnt--;
     }
     
     INTCON.f2=0;
     intcon.f1=0;
     intcon.f0=0;
}
If you are not clear i'll post whole code. So please help me.

---------- Post added at 17:43 ---------- Previous post was at 16:46 ----------

Please help me, I need ur help quickly.

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top