Display an encoder count on the 2.5" LCD display
tbriggs
Posts: 9
I am new to the propeller and am experimenting with an optical encoder. I am trying to read the encoder with the rotary encoder object and then display the count on the 2.5"LCD display. I am sure this has been done. Does someone have some code that does that so I can play around?
Thanks!
Thanks!
Comments
Have a look at the TV text demo, it should not be too much of a stretch to add a loop and get it to display the count.
Graham
The problem I am having is the encoder reading part. I have looked at the TV demo and have played with it. I guess I am not exactly sure how the encoder part works. I connected the encoder up to the bread board but I cannot tell if I am reading the encoder or not.
When I get home from work I will post my code.
Thanks!
Also, in the Quad Encoder file it says to <read [noparse][[/noparse]Pos0]>. If I want to send that value to the TV, should my call be VideoDisplay.dec(Pos[noparse][[/noparse]0])?
Thanks!
Out-A and Out-B and the two inputs to the propeller pins, (you will need a pull-up resistor for each to Propeller Vdd (3.3V) probably 10K).
Out-Z is a home sensor.
It looks like that encoder needs power also, so you'll need to connect the power lead to whatever voltage is required.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
Post Edited (Bean (Hitt Consulting)) : 1/31/2007 7:47:07 PM GMT
I'm wondering if my code is also a problem? Here's the gist, A is on Pin 2, B on pin 3.
Thoughts?
Thanks,
Alex
Encoder.Start(2, 1, 0, @Pos)
So you get absolute position not delta.
Just a thought, why not have a look at the encoder outputs on a scope or multimeter just to check they are actually switching OK.
In terms of the voltage then read the sticky on interfacing higher voltages. It may be that it has an internal reg and the output is 5v but you can check this as well.
Graham
When it says in the documentation to <read Pos[noparse][[/noparse]0]> , what exactly does it mean? Does anyone have any .spin code that uses the encoder that I could look at?
Thanks,
Alex
long pos 'Create buffer for one encoders (plus room for delta position support of 1st encoder)
OBJ
Encoder : "Rotary Encoder"
Pub Init
Encoder.Start(26, 1, 1, @Pos)
Pub MainLoop
repeat
deltaTick := Encoder.ReadDelta(0) ' reads a delta value
absolute := pos[noparse][[/noparse]0]
Remember that if you want one encoder and one support for delta you should define pos as
long pos
Alex
This cannot be as complicated as the motion control chip mfgrs make it sound.