Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Speed Sensor (http://www.chiefdelphi.com/forums/showthread.php?t=41679)

Workaphobia 13-01-2006 00:49

Re: Speed Sensor
 
Quote:

Originally Posted by Kevin Watson
Actually, I've got updated encoder code that can use any of the interrupts. The first two are just like last year's (optimized for velocity control) plus the upper four are optimized for position control, but can also be used for velocity control. I'll have it up after I finish some documentation.

-Kevin

Will that work with any encoder, or only quadrature encoders?

Kevin Watson 13-01-2006 01:34

Re: Speed Sensor
 
Quote:

Originally Posted by Workaphobia
Will that work with any encoder, or only quadrature encoders?

Quadrature only.

-Kevin

BradAMiller 13-01-2006 05:44

Re: Speed Sensor
 
Quote:

Originally Posted by Workaphobia
Will that work with any encoder, or only quadrature encoders?

The code will probably work with any single input encoder provided that you tell it that the B Channel is an input that is always high or low (disconnected or jumpered). The code will read what it thinks is the B channel and it will see the same value, making it always count in the same direction.

For example, in the interrupt service routine for EasyC you connect the A channel to pins 1-6. When the interrupt on the A channel happens, the code reads the B channel to decide whether to count up or down. It doesn't matter if the B channel is actually connected to an encoder - it only sets the count direction.

If you decide to use EasyC it has built-in encoders that only look at a single input.

Brad

Kevin Watson 13-01-2006 11:56

Re: Speed Sensor
 
Quote:

Originally Posted by BradAMiller
The code will probably work with any single input encoder provided that you tell it that the B Channel is an input that is always high or low (disconnected or jumpered). The code will read what it thinks is the B channel and it will see the same value, making it always count in the same direction.

For example, in the interrupt service routine for EasyC you connect the A channel to pins 1-6. When the interrupt on the A channel happens, the code reads the B channel to decide whether to count up or down. It doesn't matter if the B channel is actually connected to an encoder - it only sets the count direction.

If you decide to use EasyC it has built-in encoders that only look at a single input.

Brad

Actually, the new software I described, and Jon had a question about, does require a quadrature input.

-Kevin

Workaphobia 13-01-2006 13:51

Re: Speed Sensor
 
Quote:

Originally Posted by BradAMiller
The code will probably work with any single input encoder provided that you tell it that the B Channel is an input that is always high or low (disconnected or jumpered). The code will read what it thinks is the B channel and it will see the same value, making it always count in the same direction.

That's what I thought initially, but then I figured that if the phase B input is constant, then every change in the phase A input will be interpretted as the encoder moving back and forth repeatedly, instead of always forward.

Quote:

Originally Posted by BradAMiller
If you decide to use EasyC it has built-in encoders that only look at a single input.

That's good to hear. I graduated last year and had no chance to check out the new tools for this year, so I still think of these problems in terms of hand-typed code.

6600gt 13-01-2006 21:07

Re: Speed Sensor
 
This maybe a little of topic but can a PIC output a analog value directly?
It would make life a lot simpler.

Matt Krass 13-01-2006 22:24

Re: Speed Sensor
 
You can use onboard PWMs or software/timer generated PWMs to create a make shift ADC. Simply feed the output to a small capacitor connected to an analog input with a resister between the capacitor and the analog input that leads to ground.

Take a look at this: http://www.piclist.com/techref/sceni...pwm/pwm_vp.htm

Tatsu 14-01-2006 03:05

Re: Speed Sensor
 
Just use a DAC. big deal.
DACs arnt very hard to make, you could even just take a reference esign from TI or AD


All times are GMT -5. The time now is 17:37.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi