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
Quadrature and 18F4455
Moderator: Benj
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
Re: Quadrature and 18F4455
Hi Bob
The quadrature component is one of those that cannot be simulated, it only works on hardware.
The quadrature component is one of those that cannot be simulated, it only works on hardware.
1 in 10 people understand binary, the other one doesn't !
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Quadrature and 18F4455
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.
Was going to use two of them, one optical and one mechanical.
Back to the drawing board.
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
Re: Quadrature and 18F4455
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?
Ive attached a simple program which can show the encoder values on the LCD
The quad component works fine when compiled to a chip.
Are you using the Matrix rotary encoder e-block or your own hardware?
Ive attached a simple program which can show the encoder values on the LCD
1 in 10 people understand binary, the other one doesn't !
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Quadrature and 18F4455
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.
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.
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Quadrature and 18F4455
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
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
-
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
- Contact:
Re: Quadrature and 18F4455
Hello Bobw
Have a look inside the pdf.I work with toggle interruption.Work well.
Regards Wolfgang
Have a look inside the pdf.I work with toggle interruption.Work well.
Regards Wolfgang
- Attachments
-
- drehgeber_01.pdf
- (151.04 KiB) Downloaded 298 times
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Quadrature and 18F4455
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
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
-
- Posts: 155
- Joined: Sat Mar 28, 2009 5:44 pm
- Location: LYON FRANCE
- Has thanked: 3 times
- Been thanked: 41 times
- Contact:
Easy encoder with only one magnet
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: 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
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: 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
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Quadrature and 18F4455
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
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