Help for encoder counting for PID

Status
Not open for further replies.

RuH_iranga

Junior Member level 3
Joined
Nov 4, 2010
Messages
31
Helped
7
Reputation
14
Reaction score
6
Trophy points
1,288
Location
sri lanka
Activity points
1,480
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.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…