how to determine the distance by using the the RE08A

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

how to determine the distance by using the the RE08A

Postby FDH » Thu Dec 01, 2011 5:25 pm

Hi...i have a difficulty here.I had bought the rotary encoder (RE08A) and applied it to my mobile robot. I'd programming this RE08A to the PIC16F877A. The question is, how to determine the pulses of RE08A where we need to control the mobile robot for 10metre distance by using various duty cycle(PWM) which is means the same distance but various PWM. TQ
FDH
Greenhorn
 
Posts: 2
Joined: Thu Oct 13, 2011 8:02 am

Re: how to determine the distance by using the the RE08A

Postby sich » Thu Dec 01, 2011 10:51 pm

Actually the correct way is to determine how many pulses will you get from the encoder output for a certain distance. Once reaches the desired distance, stop or brake the motors. The PWM has to do which how fast the robot moves, not how far it has travelled. Of course the higher the PWM, the farther it moves in a fixed period of time. But that's different story.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 604
Joined: Tue Apr 21, 2009 2:15 pm

Re: how to determine the distance by using the the RE08A

Postby FDH » Sun Dec 04, 2011 11:02 pm

Hi...I'm actually had applied RE08A to my mobile robot. But I still don't get the actual pulses generated from this encoder. I think it's a mistake from my programming. At first it start to count 0 then when closed the beam, it started to count larger number. May anyone suggest the programming code using the counter method? I'll appreciate for ur kind....
FDH
Greenhorn
 
Posts: 2
Joined: Thu Oct 13, 2011 8:02 am

Re: how to determine the distance by using the the RE08A

Postby sich » Mon Dec 05, 2011 11:34 am

The simplest way is create a loop that senses the changes of an I/O pin connected to signal output from RE08A. So whenever the signal goes from high to low (or low to high), your program +1 to a variable.

More advanced user will choose a pin with external interrupt function and configure it for interrupt at rising-edge and/or falling-edge. Others may connect the signal to T0CKI pin and configure the Timer 0 to automatically count the pulses...
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 604
Joined: Tue Apr 21, 2009 2:15 pm


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 5 guests