Page 3 of 3

Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Thu Sep 08, 2011 8:32 am
by silveroblado
If I remember correctly!!PID control was given in robot head to toe!!volume 8!!plus u can also see the video!

Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Thu Sep 08, 2011 5:31 pm
by A380
what is HED-like quadrature encoder? LOL..
You can get the schematic in this video.


Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Mon Sep 12, 2011 11:06 am
by silveroblado
Thanks a lot!!For last couple of days i have been trying the code!!bt not achieving what i need!!I have been trying on proteus and it says some too fast!!Plus the other thing i wanted to know can this code work with 20 mhz crystal!!bcoz i gss cytron guys used 4 mhz crystal to count using encoder!!bt the code allows us to count using any crystal value right!!just wanted to confirm!!bcoz now i m losing my head!!

Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Mon Sep 12, 2011 11:32 am
by A380
silveroblado WROTE:Thanks a lot!!For last couple of days i have been trying the code!!bt not achieving what i need!!I have been trying on proteus and it says some too fast!!Plus the other thing i wanted to know can this code work with 20 mhz crystal!!bcoz i gss cytron guys used 4 mhz crystal to count using encoder!!bt the code allows us to count using any crystal value right!!just wanted to confirm!!bcoz now i m losing my head!!

20 MHz crystal oscillator should be no problem. Actually higher frequency is better because it is able to execute your code faster.

Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Mon Sep 12, 2011 1:45 pm
by silveroblado
And the last thing I want to know is what the actual function of initA = A; initB = B;

and stopA; stopB;

I cant understand where to put it!!Should I even use stopA and stopB command???

And should I write initA and initB after while(1) or should I write it after while(countAB<20).........if after while(countAB<20), should I write initA and initB in second loop also, which is after while(countAB>10)...........

Because I don't really understand the function of these commands!!

What I understand is initA and initB is for starting sending the data to the PIC and stopA and stopB is for stopping it to do so...But in sample code provided by cytron they say its for stop storing!!

Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Mon Sep 12, 2011 2:06 pm
by A380
initA = A; initB = B;
stopA = A; stopB = B;

initA and initB are used to save the current state of A and B before start counting the state.
while stopA and stopB are for saving the state once jump out the while counting loop.

Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Tue Sep 13, 2011 12:25 pm
by andyew
Hi

This encoder reader is something like this:
http://www.alldatasheet.com/datasheet-p ... -9710.html

It has basically 2 quadrature outputs, but voltage at 3.2V and 0V.

Thanks,
ANdy

Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Tue Sep 13, 2011 4:16 pm
by A380
What Micro-controller or PIC do you use? Are you using SK40C?

Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Tue Sep 13, 2011 6:09 pm
by silveroblado
PIC 16F877A with SK40C

Re: DC motor with quadrature encoder (MO - SPG -30E)

PostPosted: Tue Sep 13, 2011 8:26 pm
by A380
andyew WROTE:Hi

This encoder reader is something like this:
http://www.alldatasheet.com/datasheet-p ... -9710.html

It has basically 2 quadrature outputs, but voltage at 3.2V and 0V.

Thanks,
ANdy


After referring to its datasheet, if your PIC16F877A remain 5V, input 3.2V still in the range of logic HIGH. So, it should be no problem. Be caution for your encoder input voltage, may be its cant sustain for 5V, read its user manual first.