Page 1 of 1

Quadrature and 18F4455

Posted: Sun Apr 01, 2012 5:55 pm
by Bobw
I have started a basic FC5 using a 18F4455
I have a Glcd hooked up to portA 0 to 3
The quadrature is on portB 0 an portB 1
I have created a single variable "pcount" as ulong (just want to count pulses)
When I set everything up to run the simulation, it runs, the display starts to count up, but the encoder disappears from the panel so I can not rotate it?

Bob

Re: Quadrature and 18F4455

Posted: Sun Apr 01, 2012 6:29 pm
by JohnCrow
Hi Bob

The quadrature component is one of those that cannot be simulated, it only works on hardware.

Re: Quadrature and 18F4455

Posted: Sun Apr 01, 2012 7:16 pm
by Bobw
Begs the question of why they added it if it does nothing.
Was going to use two of them, one optical and one mechanical.
Back to the drawing board.

Re: Quadrature and 18F4455

Posted: Sun Apr 01, 2012 7:31 pm
by JohnCrow
Hi Bob
The quad component works fine when compiled to a chip.
Are you using the Matrix rotary encoder e-block or your own hardware?
Simple Rotary Encoder Test - Port B V1.fcf
(14.19 KiB) Downloaded 389 times
Ive attached a simple program which can show the encoder values on the LCD

Re: Quadrature and 18F4455

Posted: Sun Apr 01, 2012 7:55 pm
by Bobw
John,

I am using all my own hardware.
I just wanted to be able to see the encoder count up or down depending on which way I rotate it.
Will have to use a couple of switches to simulate it and see if that works.

Re: Quadrature and 18F4455

Posted: Mon Apr 02, 2012 12:06 am
by Bobw
John,

Thanks for the look at the encoder file.
Gave me a bit better understanding on how the encoder should work.
But not being able to simulate it is a major downfall.
My whole program is going to be based around reading the position based on pulses from the encoder. I was hoping to write most of the program before having to compile and test things out. But then I am still waiting for all of the electronic hardware to arrive from Digikey.

Bob :shock:

Re: Quadrature and 18F4455

Posted: Mon Apr 02, 2012 8:27 am
by saschech@gmx.de
Hello Bobw

Have a look inside the pdf.I work with toggle interruption.Work well.

Regards Wolfgang

Re: Quadrature and 18F4455

Posted: Mon Apr 02, 2012 1:41 pm
by Bobw
Wolfgang,

That's what I was working on in the simulator.
I set up 2 switches to represent the output of the encoder. I like your method for determining direction.

Once my hardware arrives I will need a simple program to just count up the pulses. I have no idea how many motor pulses will equal one revolution of the output shaft after the gear box. After that I will need to count up or down to depending on the direction going to keep your chart close by for a reference.

Thanks

Bob

Easy encoder with only one magnet

Posted: Thu Apr 05, 2012 9:31 pm
by benp
Austria microsystem manufacture a very simple to use encoder chip.
You only need to fix one magnet at the end of the rotating shaft and put the chip from 0.5 up to 2.5 mm from the rotating magnet.
The chip calculate the angle and output it when you ask it.
It is very easy to interface with flowcode, you can chain it and still need only 3 pins.

Here is my flowcode test program:
as5030testv2.fcf
(11.5 KiB) Downloaded 315 times
You can find the datasheet here and schematics here:
http://www.austriamicrosystems.com/cont ... load/12122

It is a SMT chip but it is easy to use with this adapter from farnell:
http://fr.farnell.com/roth-elektronik/r ... dp/1426182

With my test chip (AS5030), you can ask for the angle and the magnetic field. I will test the as5130 which can give the turn number in addition.

Here is a video demo:
[/youtube]

The AS5030 can count the angle up to 30000 rpm.
A quadrature encoder ask a high load from the microcontroler if the speed is high or the resolution is high.

If you really want to use quadature encoder, you can use the xor method. It's quick and simple to code.
I explained the method here.
http://www.matrixmultimedia.com/mmforum ... 589#p27781

Re: Quadrature and 18F4455

Posted: Sat Apr 07, 2012 6:33 am
by Bobw
Benp,

Thanks, will keep that in mind.
I do not for see any problems. This is a low speed AC motor (24VAC).
Being this is my first time dealing with a quad encoder,
I plan on a couple of test programs to see how many pulses per rev of the output shaft and test counting up and down.

Bob