View Full Version : Rotary Encoder Double 'clicking'
nolatron
09-02-2012, 06:13 PM
I'm hooking up the Rotary Encoders on my ProSimParts comm panels and finding they are 'double clicking' when I turn them. In other words, when I turn the dial one click, the radio digit jumps two, instead of one.
I have them connected directly to a master card. Is there anything SIOC that can slow it down? I'm thinking maybe I need one of opencockpits encoder cards so it reads the turns correctly?
mefiu
09-03-2012, 04:27 AM
Hi there,
I've had maybe not exactly the same problem you experience, but please take a look on my post on Opencockpits forum: OpenCockpits (http://opencockpits.com/modules.php?op=modload&name=Forums&file=viewtopic&topic=4016&forum=8)
n19htmare
09-03-2012, 01:02 PM
I'm new to the SIOC and MC myself but There isn't enough information in your original post to help you.
1) What is the SIOC MONITOR reporting? Is it the rotary switch working correctly? Do you have the wires connected correctly to a consecutve input (example: 20,21 or 36,37 or any thing as long as first switch is even I think. You can't connect 25,26 for example, it must be 26,27)
2) what script are you using for your comm radio? I just made a comm1 yesterday and used this script by Nico. only changes I made were to the inputs and outputs. You may have to enter device to both inputs and outputs and you'll have to make sure switch numbers are correct. that's about it, works flawlessly.
// *****************************************************************************// * Config_SIOC ver 1.98 - By Manolo Vélez - OpenCockpits (http://www.opencockpits.com)
// *****************************************************************************
// * FileName : Comm1.txt
// * Author Nico Kaan
// * Date : 10/11/2007
// * modified by Nico Kaan, April 18th, 2008
// * also incorporates a display test function - KB
//
//*********************************************
//***** COMM 1 ********************************
//*********************************************
Var 1000 name Com1_act
Var 1002 name FS_C1_SB_BCD Link FSUIPC_INOUT Offset $311A Length 2 // FS COM1 standby frequency in BCD format
Var 1003 name FS_C1_ACT_BCD Link FSUIPC_INOUT Offset $034E Length 2 // FS COM1 active frequency in BCD format
{
&Com1_act = FROMBCD &FS_C1_ACT_BCD
CALL &OutCom1_Act
CALL &C1_LH_ROT_VAL // Align rotary with new C1 SB integer val
CALL &C1_RH_ROT_VAL // Align rotary with new C1 SB decimal val
CALL &C1_UPDATE_LHS
CALL &C1_UPDATE_RHS
CALL &OutCom1_SB
}
Var 1004 name FS_C1_SWAP Link FSUIPC_OUT Offset $3123 Length 1 // FS COM1 active standby swap
Var 1005 name C1_SB_AS_DEC // COM1 standby frequency in decimal format
Var 1006 name C1_SB_LHS // COM1 standby frequency integers
Var 1007 name C1_SB_RHS // COM1 standby frequency decimals
Var 1008 name C1_RHS_ROT_VAL // COM1 right hand rotary encoder ref value
Var 1009 name C1_LHS_ROT_VAL // COM1 left hand rotary encoder ref value
Var 1010 name ROT_C1_LHS Link IOCARD_ENCODER Input 18 Aceleration 1 Type 2
{
L0 = &ROT_C1_LHS * -1
&C1_LHS_ROT_VAL = ROTATE 18 36 L0
CALL &C1_UPDATE_LHS
CALL &SET_FS_C1_SB
CALL &OutCom1_SB
}
Var 1011 name ROT_C1_RHS Link IOCARD_ENCODER Input 20 Aceleration 1 Type 2
{
L0 = &ROT_C1_RHS * -1
&C1_RHS_ROT_VAL = ROTATE 0 39 L0
CALL &C1_UPDATE_RHS
CALL &SET_FS_C1_SB
CALL &OutCom1_SB
}
Var 1012 name SW_C1_SWAP Link IOCARD_SW Input 26 Type 1 // Active/Standby swap button
{
&FS_C1_SWAP = TOGGLE 3
}
Var 1015 name SW_C1_TEST Link IOCARD_SW Input 33 // COMM TEST button sends 8's to Displays
{
IF &SW_C1_TEST = 1
{
&DISP_C1_ACT = 88888
&DISP_C1_SB = 88888
}
ELSE
{
CALL &OutCom1_Act
CALL &OutCom1_SB
}
}
Var 1020 name DISP_C1_SB Link IOCARD_DISPLAY Digit 1 Numbers 5 // Standby decimals
Var 1021 name DISP_C1_ACT Link IOCARD_DISPLAY Digit 7 Numbers 5 // active display
Var 1022 name C1_DP Link IOCARD_OUT Output 15 // Decimal Point
Var 1030 name C1_LH_ROT_VAL Link SUBRUTINE // Aligns LH rotary ref with COM1 SB freq
{
L0 = FROMBCD &FS_C1_SB_BCD
L1 = L0 / 100
&C1_LHS_ROT_VAL = TRUNC L1
}
Var 1031 name C1_RH_ROT_VAL Link SUBRUTINE // Aligns RH rotary ref with COM1 SB freq
{
L0 = FROMBCD &FS_C1_SB_BCD
L1 = &C1_LHS_ROT_VAL * 100
L2 = L0 - L1
&C1_RHS_ROT_VAL = L2 / 2.487179
}
Var 1032 name C1_UPDATE_LHS Link SUBRUTINE // Update COM1 stanby integers
{
&C1_SB_LHS = &C1_LHS_ROT_VAL
}
Var 1033 name C1_UPDATE_RHS Link SUBRUTINE // Update COM1 standby decimals
{
L0 = &C1_RHS_ROT_VAL * 2.5
&C1_SB_RHS = TRUNC L0
}
Var 1034 name SET_FS_C1_SB Link SUBRUTINE // Update COM1 standby frequency in FS
{
L0 = &C1_SB_LHS * 100
L1 = L0 + &C1_SB_RHS
&FS_C1_SB_BCD = TOBCD L1
}
Var 1040 name OutCom1_Act Link SUBRUTINE
{
//IF &MAST_SW = 1 // Section for use with a master switch. Not yet implemented
//{
L0 = &Com1_act
&DISP_C1_ACT = L0 + 10000
}
//ELSE
//{
//&DISP_C1_ACT = -999999 // blank
//}
//}
Var 1041 name OutCom1_SB Link SUBRUTINE
{
//IF &MAST_SW = 1
//{
&C1_DP = 1
L0 = &C1_SB_LHS * 100
L1 = L0 + &C1_SB_RHS
&DISP_C1_SB = L1 + 10000
}
//ELSE
//{
//&C1_DP = 0
//&DISP_C1_SB = -999999 // blank
//}
//}
nolatron
09-03-2012, 02:04 PM
1) What is the SIOC MONITOR reporting? Is it the rotary switch working correctly? Do you have the wires connected correctly to a consecutve input (example: 20,21 or 36,37 or any thing as long as first switch is even I think. You can't connect 25,26 for example, it must be 26,27)
SIOC Monitor shows the rotary's are functioning. The Comm rotary for example is connected as follows:
Freq: 5,6
Decimal: 7,8
[QUOTE=n19htmare;134227]2) what script are you using for your comm radio? I just made a comm1 yesterday and used this script by Nico. only changes I made were to the inputs and outputs. You may have to enter device to both inputs and outputs and you'll have to make sure switch numbers are correct. that's about it, works flawlessly.
The script I'm using looks similar to yours. I actually found it on kennair.com via google. here's my Comm script:
//*********************************************
//***** COMM 1 ********************************
//*********************************************
Var 1000 name Com1_act
Var 1002 name FS_C1_SB_BCD Link FSUIPC_INOUT Offset $311A Length 2 // FS COM1 standby frequency in BCD format
Var 1003 name FS_C1_ACT_BCD Link FSUIPC_INOUT Offset $034E Length 2 // FS COM1 active frequency in BCD format
{
&Com1_act = FROMBCD &FS_C1_ACT_BCD
CALL &OutCom1_Act
CALL &C1_LH_ROT_VAL // Align rotary with new C1 SB integer val
CALL &C1_RH_ROT_VAL // Align rotary with new C1 SB decimal val
CALL &C1_UPDATE_LHS
CALL &C1_UPDATE_RHS
CALL &OutCom1_SB
}
Var 1004 name FS_C1_SWAP Link FSUIPC_OUT Offset $3123 Length 1 // FS COM1 active standby swap
Var 1005 name C1_SB_AS_DEC // COM1 standby frequency in decimal format
Var 1006 name C1_SB_LHS // COM1 standby frequency integers
Var 1007 name C1_SB_RHS // COM1 standby frequency decimals
Var 1008 name C1_RHS_ROT_VAL // COM1 right hand rotary encoder ref value
Var 1009 name C1_LHS_ROT_VAL // COM1 left hand rotary encoder ref value
Var 1010 name ROT_C1_LHS Link IOCARD_ENCODER Device 1 Input 5 Aceleration 0 Type 2
{
L0 = &ROT_C1_LHS
&C1_LHS_ROT_VAL = ROTATE 18 36 L0
CALL &C1_UPDATE_LHS
CALL &SET_FS_C1_SB
CALL &OutCom1_SB
}
Var 1011 name ROT_C1_RHS Link IOCARD_ENCODER Device 1 Input 7 Aceleration 0 Type 2
{
L0 = &ROT_C1_RHS
&C1_RHS_ROT_VAL = ROTATE 0 39 L0
CALL &C1_UPDATE_RHS
CALL &SET_FS_C1_SB
CALL &OutCom1_SB
}
Var 1012 name SW_C1_SWAP Link IOCARD_SW Device 1 Input 11 Type 1 // Active/Standby swap button
{
&FS_C1_SWAP = TOGGLE 3
}
Var 1015 name SW_C1_TEST Link IOCARD_SW Device 1 Input 10 // COMM TEST button sends 8's to Displays
{
IF &SW_C1_TEST = 1
{
&DISP_C1_ACT = 88888
&DISP_C1_SB = 88888
}
ELSE
{
CALL &OutCom1_Act
CALL &OutCom1_SB
}
}
Var 1020 name DISP_C1_SB Link IOCARD_DISPLAY Device 1 Digit 5 Numbers 5 // Standby decimals
Var 1021 name DISP_C1_ACT Link IOCARD_DISPLAY Device 1 Digit 11 Numbers 5 // active display
Var 1022 name C1_DP Link IOCARD_OUT Device 1 Output 20 // Decimal Point
Var 1023 name C1_DPS Link IOCARD_OUT Device 1 Output 21 // Decimal Point
Var 1030 name C1_LH_ROT_VAL Link SUBRUTINE // Aligns LH rotary ref with COM1 SB freq
{
L0 = FROMBCD &FS_C1_SB_BCD
L1 = L0 / 100
&C1_LHS_ROT_VAL = TRUNC L1
}
Var 1031 name C1_RH_ROT_VAL Link SUBRUTINE // Aligns RH rotary ref with COM1 SB freq
{
L0 = FROMBCD &FS_C1_SB_BCD
L1 = &C1_LHS_ROT_VAL * 100
L2 = L0 - L1
&C1_RHS_ROT_VAL = L2 / 2.487179
}
Var 1032 name C1_UPDATE_LHS Link SUBRUTINE // Update COM1 stanby integers
{
&C1_SB_LHS = &C1_LHS_ROT_VAL
}
Var 1033 name C1_UPDATE_RHS Link SUBRUTINE // Update COM1 standby decimals
{
L0 = &C1_RHS_ROT_VAL * 2.5
&C1_SB_RHS = TRUNC L0
}
Var 1034 name SET_FS_C1_SB Link SUBRUTINE // Update COM1 standby frequency in FS
{
L0 = &C1_SB_LHS * 100
L1 = L0 + &C1_SB_RHS
&FS_C1_SB_BCD = TOBCD L1
}
Var 1040 name OutCom1_Act Link SUBRUTINE
{
&C1_DP = 1
L0 = &Com1_act
&DISP_C1_ACT = L0 + 10000
}
Var 1041 name OutCom1_SB Link SUBRUTINE
{
&C1_DPS = 1
L0 = &C1_SB_LHS * 100
L1 = L0 + &C1_SB_RHS
&DISP_C1_SB = L1 + 10000
}
nolatron
09-03-2012, 02:26 PM
Tried that script from Nico but had the same result. I'll need to email ProSimParts but I'm starting to think maybe the encoders are not the "gray" type and I will need an encoder board for them.
Hi nolatron,
Opencockpits M/C inputs for encoders are very fussy. Best to use here are the CTS288 .Anything else very questionable.
Even the encoders card can be funny also.
Les
n19htmare
09-03-2012, 09:16 PM
I have lots of encoders laying around. Even cheap 40 cent ones. None of them work with the Master Card. Only one that works are the CTS288.
However, ALL my encoders work with the Leo Bodnar input card. Even the cheap 40 cent ones.
I myself was looking into prosimparts set (comm, Nav, ADF, transponder) but if they are not using cts2888, I'm not so sure.
pilotgil
09-04-2012, 05:48 PM
Oh, I have had so many problems with encoders. 1/2 clicks, double clicks, random clicks, too fast, too slow, etc. Even one PCB to the next sometimes act differently. I had enough so I designed my own "encoder decoder" that has solved this seemingly never-ending headache (for me at least). Now I have reliable outputs both at faster and slow rates, true and inverted logic, and buffered in and out drive. If anyone is interested, I sell a small PCB or can even sell the chip itself. See my website under products:
ATSimulation » Page 1 of 7 (http://www.atsimulation.com)
But here is my advice through trail and error with these @@#$%! devices.
1. Not all manufacturers make great encoders. Some are noisy suckers.
2. Some are really unreliable and improper soldering will warp the internal wipers just enough to make you nuts.
3. Filtering. It's all about the filtering. Your code has got to properly filter the inputs. All switch contacts "bounce".
4. XORing the logic can create false outputs especially if you use interrupts. You have to trap error states.
5. Signal integrity. Long wires from the encoder to the decoder can be a bad thing. They will pickup noise if you are not careful.
6. Finally, you have to know the output codes for each switch transition and "click".
n19htmare
09-06-2012, 11:43 PM
Pilotgil, is that $29 PER Encoder? seems like it would get pricey............fast.
To Nolatron. I wonder if you can use something like the Leo Bodnar input card ($50) (http://www.leobodnar.com/shop/index.php?main_page=product_info&cPath=86&products_id=205) for the Encoders only. It will handle 16 Encoders.
Then you can use a script for displays and button inputs. I know it sucks to add even more input cards but it might be what's needed.
pilotgil
09-07-2012, 01:13 AM
In my opinion, it all depends on your design objectives. For example, if you are designing an integrated radio stack, it makes sense to buy an integrated card to handle the various encoders. However, I found that what I usually ended up with was with cards with unused inputs, a rats nest of wires running from one side of the sim to the other, in order to use some unused input. Also, I found with the long wires, besides wires everywhere, noise problems, reliability problems, and general frustration. This was my experience and yours may be different. I really dislike wires and my objective is to have a processed, clean, low impedance signal to a local interface card.
Good luck!
I'm hooking up the Rotary Encoders on my ProSimParts comm panels and finding they are 'double clicking' when I turn them. In other words, when I turn the dial one click, the radio digit jumps two, instead of one.
I have them connected directly to a master card. Is there anything SIOC that can slow it down? I'm thinking maybe I need one of opencockpits encoder cards so it reads the turns correctly?
Always look carefully at the specs for the encoders that work directly with a Master Card; if you do that, you will have no problems at all....
Here is more info about the Encoder (http://www.lekseecon.nl/iocards.html#encoder) and here more about how to program an encoder in SIOC (http://www.lekseecon.nl/howto.html#rotaryencode).
nico
nolatron
09-07-2012, 10:43 PM
Well tonight has been a whirlwind of trial and error.
First I received my encoder card from opencockpits. I couldn't really get the card to work properly though. I don't know what I could be doing wrong as I followed the guide on the product page.
I have the card ground connected to a ground on the input card, then pins 1 and 2 connected to consecutive inputs in the same ground group. What I noticed though was as soon as I connect ground, the inputs light up as if being active. I connected one encoder output to the encoder 1 pins as shown but I got no response from it. The inputs just always show as active.
Next I thought maybe I needed 5v. So I tapped into the wire running to the MasterCard, but when I would connect the wires to the encoder card, all kinds of inputs lit up.
So while getting frustrated with this I smacked myself in the head when I realized I could probably use my pokeys cards for the encoders. I hooked up one up, set the sampling rate to 2x in the pokeys config, set the actions in fsuipc and bam, they worked. You can't spin them too fast as they won't change the value (I bumped pollinterval down to 10 for a decent speed).
Id still like to try to get the encoder cards working if possible, so any ideas what could be going onwith them?
Otherwise if anybody needs some brand new encoder cards drop me a line :)
oal331
09-08-2012, 06:52 AM
Var 1010 name ROT_C1_LHS Link IOCARD_ENCODER Device 1 Input 5 Aceleration 0 Type 2{L0 = &ROT_C1_LHS&C1_LHS_ROT_VAL = ROTATE 18 36 L0 CALL &C1_UPDATE_LHS CALL &SET_FS_C1_SB CALL &OutCom1_SB } Var 1011 name ROT_C1_RHS Link IOCARD_ENCODER Device 1 Input 7 Aceleration 0 Type 2 { L0 = &ROT_C1_RHS&C1_RHS_ROT_VAL = ROTATE 0 39 L0 CALL &C1_UPDATE_RHS CALL &SET_FS_C1_SB CALL &OutCom1_SB
Can anyone explain me please, how all these values working ? : &C1_RHS_ROT_VAL = ROTATE 0 39 L0 or ROTATE 18 36 L0
Can i program an OpenCockpit's gray type rotary encoder (Gray type encoder. Connects directly to Master card. CTS ref: 288VCC0F161B2) for sending numbers from -1000 to 42000 or from -1000 to 14000 in 500 feet increments ?
regards
Eddie
Perik
09-08-2012, 08:02 AM
Hello nolatron (strange name BTW)
Never used this version of EncoderII myself, but to get the OC EncoderII board to work
you’ll have to apply +5V (+5V and GND) at the marked pins – GND which should be
the same as the general Ground signal through out your setup.
Don’t mix up with Input Group Ground.
Connecting the encoder device should be straight forward as in the OC supplied "manual".
For connections to Mastercard pick one Input group. Wire pin 9 on EncoderII to
common Gnd for this group and encoders (EC1-4) as you have done already.
nolatron
09-08-2012, 08:49 AM
Hello nolatron (strange name BTW)
Never used this version of EncoderII myself, but to get the OC EncoderII board to work
you’ll have to apply +5V (+5V and GND) at the marked pins – GND which should be
the same as the general Ground signal through out your setup.
Don’t mix up with Input Group Ground.
So what I tried was using this morning was 5v and GRD terminals on the output card. I connected these to the 5v pin on the encoder card (with 5v being on pin 2)
I then connect on the 9row pin: Pin 1 to input terminal 7 and pin 2 to input terminal 8. When I connect Pin 9 to the ground input terminal, SIOC Monitor shows both inputs lit up as active.
If I disconnect Pin 2, input 8 goes inactive but input 7 starts flashing as if an encoder is rotating, but this whole time no encoder is connected.
When I connect an encoder as needed, there's no input read from it all. hmm
As for the name, it's s combination of where I live (New Orleans, LA = NOLA) and favorite movie of mine, Tron. :)
nolatron
09-08-2012, 08:51 AM
Can anyone explain me please, how all these values working ? : &C1_RHS_ROT_VAL = ROTATE 0 39 L0 or ROTATE 18 36 L0
Can i program an OpenCockpit's gray type rotary encoder (Gray type encoder. Connects directly to Master card. CTS ref: 288VCC0F161B2) for sending numbers from -1000 to 42000 or from -1000 to 14000 in 500 feet increments ?
regards
Eddie
You need to add some info to the L0 var I think to get your increments set. See here for an example:
How to program in SIOC, many basic examples (http://www.lekseecon.nl/howto.html#dualencoder)
nolatron
09-08-2012, 09:35 AM
This looks to be the encoder used by ProSimParts from what I can tell. The only marking on the encoder is Alps and this is the only Dual encoder they make:
EC11 Series - Basic information (http://www.alps.com/WebObjects/catalog.woa/E/HTML/Encoder/Incremental/EC11/EC11EBB24C03.html)
oal331
09-08-2012, 09:50 AM
You need to add some info to the L0 var I think to get your increments set. See here for an example:
How to program in SIOC, many basic examples (http://www.lekseecon.nl/howto.html#dualencoder)
Of course i have done it :-)
I was asking only for the structure of ROTATE command but i got a reply at another thread asking about a sioc problem i have.
Deleted as issued solved already :
If you can help aslo, please check here latest post : http://www.mycockpit.org/forums/i-o-interfacing-hardware/25160-need-help-sioc.html#post134345 (http://www.mycockpit.org/forums/i-o-interfacing-hardware/25160-need-help-sioc.html#post134345)
Regards
Eddie
pilotgil
09-08-2012, 02:21 PM
The dual ALPS encoder is gray code but detents at each 1/2 cycle. Meaning, if you are waiting for four state changes for a "tick" you will get double the "ticks".
Perik
09-08-2012, 02:57 PM
Nolatron,
If you have a PIC programmer you could try to replace the firmware
on OC Encoder board with the one from Terry : Rotary Encoders (http://overkillsystems.com/id12.html)
I know it works quite well for 1/2 cycle encoders - I'm using it ;-)
nolatron
09-08-2012, 03:42 PM
Nolatron,
If you have a PIC programmer you could try to replace the firmware
on OC Encoder board with the one from Terry : Rotary Encoders (http://overkillsystems.com/id12.html)
I know it works quite well for 1/2 cycle encoders - I'm using it ;-)
Gah, I wish I did. I'm scouring around for a cheap one now. Any recommendations?
nolatron
09-08-2012, 04:33 PM
For the heck of it I pick up a PIC programmer from ebay. Should be here by Thursday possibly. I'll give the cards a reprogram to see if that helps, if not.. well I have a PIC programmer :)
Perik
09-08-2012, 05:32 PM
Good move, Nolatron
I picked a JDM programmer from:
JDM PIC Programmer 16F84 Microchip with 40 and 18 zif sockets (http://www.virtualvillage.com/jdm-pic-16f84-programr-microchip-006401-002.html)
Even if I have a PICKIT 3 I use this JDM quite often - nice unit.
Good luck with the programming ;-)
nolatron
09-20-2012, 07:47 PM
Got my programmer today (1st one was a cheap clone that didn't work)and wrote that HEX file to the Encoder chip (at least I'm pretty sure it did) but still no difference.
The encoder card itself acts like it's ignoring the encoder inputs. Soon as I connect ground to Pin 9, the inputs on Pin 1 and 2 light right up and the encoder has no affect on it.
I sent O/C an email about it to see what they say
nolatron
09-20-2012, 08:11 PM
Holy Moly! It works! I've been connecting the encoder to "Encoder 1" on the board. Seems logical to start at "1" right. Well, after tinkering around I shorted pins on "Encoder 4" and BAM, my radio started changing. Hooked up the encoder and it's working great now. I get single digit changes for each detent.
Gonna grab a 2nd one and try to connect to Encoder 3 now.