Bi-phase rotary encoder

Forum for problems or queries regarding Flowcode Comms Components. Eg LIN, I2C, SPI, RS232, CAN, IrDA etc

Moderators: Benj, Mods

Post Reply
jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Bi-phase rotary encoder

Post by jadiflow »

Hello,

I need to inteface a rotary encoder to a PIC. I can bit-bang it, but I would like to know if there is a standard macro for such a component available?

TIA,

Jan Didden

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bi-phase rotary encoder

Post by Benj »

Hello Jan

Some of the PICmicro chips have quadrature encoders built in as a peripheral. These can be used with flowcode via C code calls. Currently there is no component to utilize this hardware.

Other then this yes you will have to perform a bit banged interface.

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: Bi-phase rotary encoder

Post by jadiflow »

OK, thanks.

Jan Didden

User avatar
mytekcontrols
Posts: 95
Joined: Sun Aug 19, 2007 6:38 pm
Location: Santa Rosa, California
Has thanked: 4 times
Been thanked: 7 times
Contact:

Re: Bi-phase rotary encoder

Post by mytekcontrols »

Not that I have a need for this at the moment (although I have used these in the past); a Quadrature Encoder Component seems like it would make a great addition to flowcode. Any plans to add one in the near future?

Edit: Just realized that this post might have been better posted in the "Components Other" section, since this isn't really a communication component (or is it :?: )
Michael St. Pierre
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Bi-phase rotary encoder

Post by Sean »

We are working on quadrature encoder functions as part of a proposed, advanced motor control project. There are several possible techniques that avoid the requirement for a dedicated hardware interface module. These depend on the maximum frequency of the encoder signals and the availability of other device resources (timers, interrupts etc.)

It should be possible to make some development macros available in the very near future.

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: Bi-phase rotary encoder

Post by jadiflow »

That would be nice!

Another, related, question: does Flowcode support the Interrupt-on-Change feature on some PIC ports? Or do I need to set the appropriate registers in C or ASM supplemental code?

Edit: answer found elsewhere: No

Jan Didden
Last edited by jadiflow on Sun Jun 01, 2008 12:41 pm, edited 1 time in total.

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: Bi-phase rotary encoder

Post by jadiflow »

... and one more:

Using the switch macro to read a switch, you need to specify a variable WhichSwitch(byte). What does that signify? If I have switches A1...A8, and I want to read switch A3, do I use WhichSwitch = 2? 3?
If I define a variable SW3(byte), and give the switch also the label SW3, can I then use SW3 as variable to access the switch as well as the return variable name?

Jan Didden

Post Reply