Encoder/Motor control


Closed Thread
Results 1 to 3 of 3
  1. #1
    mc33033's Avatar
    mc33033 Guest

    Default Encoder/Motor control

    Hi everyone,

    I want to do something that I imagine lots of people have done before, but I don't know the best way to do it!

    I have a small dc motor which drives via a pulled a rod which has a worm gear on it and a arm moves up and down the pulley (part of an old CD duplicator robot). There is a small disc with stripes on it at the end of the pulley and a "transmissive encoder sensor". That's the background, the idea is that if the arm hits something, the PIC recognises a lack of change in the encoder and stops the motor. Hooking it up is OK, but what method do I use for reading in the pulses? Pulsin or count over a time period (or something else?) The motor will no doubt take a fraction of a second to spin up, too - this may also need to be taken into account. I'd appreciate any advice, thanks!

  2. #2
    G8RPI's Avatar
    G8RPI Guest


    Did you find this post helpful? Yes | No

    Default

    Hi,
    A quick and dirty way of doinig this is to use PULSIN. If the value returned is zero then there was no pulse. Note that PULSIN will take .65 seconds to time out if there is no pulse, this can be reduced by using the DEFINE PULSIN_MAX
    A value of 1000 will time out in 0.01S (assuming a 4MHz clock).

    HTH,
    Robert G8RPI.

  3. #3
    mc33033's Avatar
    mc33033 Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Robert, I think I'm getting there. I've used pulsin successfully now to detect movement after wasting a lot of time by not putting CMCON=7 at the head of the file :-(

    Thanks again!

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts