Results 1 to 10 of 21
Thread: Can SOIC handle switch bounce?
-
10-19-2009, 10:33 PM #1
Can SOIC handle switch bounce?
I have a micro switch working with a 10" long lever for my canopy switch. In trying to get it to open properly with SOIC I kept running into problems with the opening and closing of the canopy getting out of sequence.
Using the logging function of SOIC (SOIC Config?) I noticed switch bouncing and multiple contacts at times. The code is set to set and clear the 0 bit of the offset. I think this is screwing up the sequence.
Is there a way to delay the switch reading for a few milliseconds?John
System:
ASUS P5Q SE/R
Intel Q9550 O/C to 3.4 GHz
4 GB 1066 DDR2 RAM
300 GB WD 10,000 RPM Raptor SATA Drive
GeForce 8800 GT 512 KB RAM
Matrox TH2Go with three 19" Sumsung 940 BX
IR Track 4
-
10-20-2009, 03:58 AM #2
- Join Date
- Jul 2013
- Posts
- 917
Re: Can SOIC handle switch bounce?
John
It could be that the SIOC code is too fast for the hardware. Try inserting a software delay between reading and resetting the offset. There is an example of the SIOC DELAY function on Nicos` site here
http://www.lekseecon.nl/howto.html
Regards
David
-
10-20-2009, 07:14 AM #3
Re: Can SOIC handle switch bounce?
The DELAY function won't help here. I am getting a manual switch bounce. the long lever and torque created is causing the little micoswitch to open and close two or three times when the handle is moved to close the switch.
DELAY will only delay the sim action. I need to have a delay between the time the switch closes and SOIC reads it closed. Otherwise, it is redesign the entire mechanism which, of course, is not easy to get to without removing the ejection seat, side panel, etc.
Ahhhh, such is a sim builder's life.John
System:
ASUS P5Q SE/R
Intel Q9550 O/C to 3.4 GHz
4 GB 1066 DDR2 RAM
300 GB WD 10,000 RPM Raptor SATA Drive
GeForce 8800 GT 512 KB RAM
Matrox TH2Go with three 19" Sumsung 940 BX
IR Track 4
-
10-20-2009, 07:30 AM #4
Re: Can SOIC handle switch bounce?
Hi John,
The Master Card of OC takes care of de-bouncing, but I assume your switch bouncing is too long stretched in time.
You can either solve that with extra hardware: http://www.electronixexpress.com/t_bounc.htm
or you can solve this in SIOC, with the DELAY function and a sempahore, it goes like this:
Code:Var 1 Value 0 // semaphore Var 2 Link IOCARD_SW Input xy // connected to your switch { IF v1 = 0 { v1 = 1 // set semaphore v3 = DELAY v2 50 // assign v2 to v3 after .5 second } } Var 3 { v1 = 0 // reset semaphore L0 = v3 // L0 contains the de-bounced input // ... }
Nico Kaan
-
Post Thanks / Like - 1 Thanks, 0 Likes, 0 Dislikes
jmig thanked for this post
-
10-20-2009, 07:33 AM #5
Re: Can SOIC handle switch bounce?
Thanks Nico! I will try this tonight.
John
System:
ASUS P5Q SE/R
Intel Q9550 O/C to 3.4 GHz
4 GB 1066 DDR2 RAM
300 GB WD 10,000 RPM Raptor SATA Drive
GeForce 8800 GT 512 KB RAM
Matrox TH2Go with three 19" Sumsung 940 BX
IR Track 4
-
10-20-2009, 07:52 AM #6
Re: Can SOIC handle switch bounce?
Okay, let me know the result.
I was wondering, maybe it is even more reliable to take v2 as end result so in Var 3 write:
L0 = v2 // L0 contains the de-bounced input
-
10-20-2009, 08:08 AM #7
- Join Date
- Aug 2008
- Location
- UK
- Posts
- 128
Re: Can SOIC handle switch bounce?
Obviously if you can do it in software that would be the easiest route, but if not you could do it in hardware. A simple RC circuit would do it, but you'd need power:
http://www.electronixexpress.com/t_bounc.htm
Depends how handy you are with a soldering iron.
-
10-20-2009, 01:58 PM #8
- Join Date
- Jul 2013
- Posts
- 917
Re: Can SOIC handle switch bounce?
Nico
Thanks, I knew there would be a way of solving this in SIOC.
Regards
David
-
10-20-2009, 10:37 PM #9
Re: Can SOIC handle switch bounce?
OK Nico, I have it working and it seems to help some? i am still getting out of sync but it could be something else. Here is my code snippet. See if i manged to code it the way you were thinking.
I still think I will redesign the switch sometime. It is just too loose with no feel.
// ************************** Canopy ********************************
Var 8000, Value 0 // Initialization
Var 8001, name canopysw, Link IOCARD_SW, Input 7, TYPE I
{
IF V8000 = 0
{
&canopysw = 1
&canopy = DELAY &canopysw 50 // assign .5 delay to canopysw
}
}
Var 8002, name canopy, Link FSUIPC_INOUT, Offset $3367, Length 1
{
V8000 = 0
L0 = &canopy
}John
System:
ASUS P5Q SE/R
Intel Q9550 O/C to 3.4 GHz
4 GB 1066 DDR2 RAM
300 GB WD 10,000 RPM Raptor SATA Drive
GeForce 8800 GT 512 KB RAM
Matrox TH2Go with three 19" Sumsung 940 BX
IR Track 4
-
10-21-2009, 12:13 AM #10
Re: Can SOIC handle switch bounce?
Hi,
Isnt there a mistake in the script, I think it should be like the following :
Var 8000, Value 0 // Initialization
Var 8001, name canopysw, Link IOCARD_SW, Input 7, TYPE I
{
IF V8000 = 0
{
V8000 = 1
&canopy = DELAY &canopysw 50 // assign .5 delay to canopysw
}
}
Var 8002, name canopy, Link FSUIPC_INOUT, Offset $3367, Length 1
{
V8000 = 0
L0 = &canopy
}
another solution is to do the following :
when the canopy switch changes, the V8000 is set to 1 and the fsuipc offset
is written immediately but the following updates of the canopysw are not possible
since V8000 is 1. Only after the delay time the V8000 is reset to 0 allowing further
updates of the canopysw
(Niko, correct me if Im wrong here!)
Var 8000, name canopyUpdate, Value 0 // Initialization
Var 8001, name canopysw, Link IOCARD_SW, Input 7, TYPE I
{
IF &canopyUpdate = 0
{
&canopyUpdate = 1
&canopy = &canopysw
&canopyUpdate = DELAY 0 50
}
}
Var 8002, name canopy, Link FSUIPC_INOUT, Offset $3367, Length 1FS9+PM+AST+opencockpits
-
Post Thanks / Like - 1 Thanks, 0 Likes, 0 Dislikes
jmig thanked for this post
Similar Threads
-
HELP, i am totally lost with SOIC
By Jasmckee in forum OpenCockpits General DiscussionReplies: 1Last Post: 07-06-2010, 03:21 AM -
737 reverser handle
By ivar hestnes in forum General Builder Questions All Aircraft TypesReplies: 0Last Post: 04-11-2009, 06:18 PM -
Sound for Flaps Handle
By flightdeck in forum PM General Q & AReplies: 2Last Post: 02-17-2008, 04:24 PM