PDA

View Full Version : SIOC and Offset 023A



Boeing 747 Flyer
04-17-2012, 07:46 AM
Hello everyone,

I am trying to use Offset 023A (the Glideslope Indicator Needle) with little success.

The FSUIPC documentation states that it ranges from -127 to +127 (from up to down), however, the SIOC IOCPConsole sees the values going from +138 (top), to +254 (middle), then back to 0 and finishing at around 120 (bottom).

Does anyone know why this offset doesn't appear to give the values it should?

Cheers,

Jack

fordgt40
04-17-2012, 08:16 AM
Jack

I think we may have been here before :D

Add type 1 to the glideslope offset definition and try that

David

Perik
04-17-2012, 08:19 AM
Hello Jack

Are you sure that's the correct Offset?

Boeing 747 Flyer
04-17-2012, 08:58 AM
Thank you David, I shall try the type 1 trick. We have have been here before but it was so long ago I can't remember! Did we get anywhere with this? I'm redesigning my HSI scripts because I've lost some of them on my hard drive.

@Perik - According to the FSUIPC SDK documentation, Offset 023A is the glideslope needle indicator. Should I be using a different offset?

Jack

fordgt40
04-17-2012, 09:05 AM
Jack

Here is the link

http://www.mycockpit.org/forums/showthread.php/22813-Scaling-Localiser-and-Glideslope-Needles-for-HSI/page5?highlight=integer

I found it yesterday when trying to code sioc to drive the elevator trim servos :p

David

Perik
04-17-2012, 09:38 AM
As you have in your own code from the link David supplied:

Var 53 link FSUIPC_IN Length 1 Offset $023A // seconds of FS time (0 - 59)

$023A seems to not have anything to do with the Glideslope as far as I can see but as usually I may be totally wrong ;-)

Boeing 747 Flyer
04-17-2012, 10:34 AM
Hi Perik,

Yes the offset should be 049C.

On another note, can anyone tell me why this:


Var 0 Value 0
{
&control = 0
&control = TIMER 1 0 5
}


Var 15 name control Link SUBRUTINE

Does not start a Timer when SIOC is started?

Cheers,

Jack

kiek
04-17-2012, 02:11 PM
Does not start a Timer when SIOC is started?


? does it not start?
It should start, see my example of: an endless Timer (http://www.lekseecon.nl/howto.html#endless)

regards,
Nico

kiek
04-17-2012, 03:16 PM
this should work too:


&control = TIMER 100000 1 5

Boeing 747 Flyer
04-17-2012, 06:21 PM
Hi Nico,

After compiling the script I go to IOCPConsole. The "control" variable does not count up.

Cheers,

Jack

Perik
04-18-2012, 03:08 PM
Jack

The "Endless timer" example from Nico works great at my end.
&control will never change but the timer works great anyway.

Extend the code this way:

Var 0 Value 0

{
&control = 0
&control = TIMER 1 0 5
}
Var 10 name Counter Value 0

Var 1 name control Link SUBRUTINE
{
&Counter = &Counter + 1
// regular control work in here (is called every 50 msec)
}

And check &Counter in IOCP Console and you'll see it increments like a dream ;-)

BTW - $049C seems to be another "wrong" FSUIPC offset.:shock:

kiek
04-18-2012, 04:06 PM
Hi Guys,

It is indeed 'by design' that the control variable stays 0 in my endless timer example. Simply because the increment is 0... so control stays endless 0 and never reaches 1.... but the Timer works flawlessly and calls the control subroutine every 50 ms.

:-) :-) :-)

Nico

Boeing 747 Flyer
04-18-2012, 11:00 PM
Thank you everyone.

I was under the impression that, after starting a timer, &control would change values as it counts up. As long as it calls the Subroutine; I don't care ;)!!!

PS: Does anyone know how to define the Potentiometers from the USBDCMotors card in SIOC? They are defined in my SIOC.ini as "USBAnalogic, Device 0,38". I do, however, have Potentiometers connected to my USBEXpansion card; so how do I differentiate between the two devices?

PS2: I haven't done any SIOC scripting in about 6 months; sorry if I'm a little rusty!

fordgt40
04-19-2012, 04:17 AM
Jack

Surely not so rusty that the "help file" has also seized up to :)

It is all in the Help section of Config

USB_Analogic etc etc and IOCARD_Analogic etc etc

Regards

David

Boeing 747 Flyer
04-19-2012, 08:46 AM
Hi David,

That's the problem. I have the Pots defined in the .ini as USBAnalogic=0,38 - Just as the manual says.

I then reference it in the SIOC file like so:


Var 0003, name Pot_GS, Link USB_ANALOGIC, Device 0, Input 2, PosL 97, PosC 133, PosR 170 // Potentiometer for GS

Now, according to the manual, that's correct.

fordgt40
04-19-2012, 09:17 AM
Jack

You asked how to reference the pots when they are connected to the USBExpansion card.
The answer is to use the definition Link IOCard_analogic, Device?, Input ? etc etc.

Do you now have a different problem?

David

Boeing 747 Flyer
04-19-2012, 01:26 PM
Hi David,

I'm talking about reference the Pots if they're connected to the DC Motors Card, not the USBExpansion Card.

Cheers,

Jack

fordgt40
04-19-2012, 02:39 PM
Jack

"I do, however, have Potentiometers connected to my USBEXpansion card; so how do I differentiate between the two devices?"

That was the question I was answering. :(

With regard to USB devices, I believe it is as you have typed.

I will do some checking later and revert if anything comes to mind. I need to spray the Stab Trim guards on my throttle :)

David

Boeing 747 Flyer
04-19-2012, 09:32 PM
The USBExpansion Card is listed as "Device 0" in the SIOC.ini, and it has Pots connected to it.

Likewise, the USBDCMotors Card is also "device 0" (since it's my only motors card), but it too has Pots connected to it.

I'm wondering how to define Potentiometers on the USBDCMotors Card.

Cheers,

Jack :)

fordgt40
04-20-2012, 04:44 AM
Jack

Your post # 15 above appears to correctly answer your question. So what is the problem?

David

Perik
04-20-2012, 07:37 AM
Jack,

Don't forget to use SIOC Monitor to verify your A/D's as well
the rest of your IOcards - a great tool!!

Boeing 747 Flyer
04-20-2012, 10:54 AM
Thanks Perik.

David, the problem is that, despite doing exactly as in post #15, the Pot still doesn't change value when the motor moves.

Tests in SIOC Monitor show that it changes perfectly well; so why not in the script?

Cheers,

Jack

fordgt40
04-20-2012, 10:58 AM
Jack

Try posting your script.

David

Boeing 747 Flyer
04-20-2012, 11:11 AM
This is my script:


Var 0 Value 0
{
&Motor_GS = 255
}

Var 9, name Motor_GS, Link USB_DCMOTOR, Output 1 // Motor

Var 0003, name Pot_GS, Link USB_ANALOGIC, Device 0, Input 2, PosL 97, PosC 133, PosR 170 // Potentiometer for Glideslope

Var 0 gets the motor moving, which obviously turns the pot (for the glideslope).

This is the SIOC.ini:


[SIOC]
IOCP_port=8092
IOCP_timeout=4000
Minimized=Yes
toggle_delay=20
CONFIG_FILE=Cockpit_Full.ssi
[IOCARDS MODULE]
IOCard_disable=No
IOCard_LPT=No

[USBSTEPPER]
USBStepper=0,195

[USBKEYS]
USBKeys=0,13

[USBDCMOTORS]
USBDCmotor=0,38

[USBDCMOTORSPOTS]
USBAnalogic=0,38

[MASTERS]
MASTER=3,11,1,70
MASTER=2,5,1,50
MASTER=0,4,4,176
MASTER=5,8,1,187

[A/D USED MASTER]
USB_AD=4

[MULTIPLE]
MUSB=Yes

[USBSERVOS]
USBSERVOS=0,4
deviceUSB=2132

[FSUIPC MODULE]
FSUipcdisable=No
FSUipcRefresh=50

[IOCP CLIENTS MODULES]
IOCPini_delay=3000
IOCPclient0_disable=Yes
IOCPclient0_host=localhost
IOCPclient0_port=8090
IOCPclient1_disable=Yes
IOCPclient1_host=localhost
IOCPclient1_port=8099

[SOUND MODULE]
Sound_disable=NO
Volume=100


Cheers,

Jack

bobsta63
04-20-2012, 11:26 AM
Isn't it because you haven't specified the 'Device Number' for: 'Motor_GS' (Var 9)


Var 9, name Motor_GS, Link USB_DCMOTOR, Output 1 // Motor

Var 0003, name Pot_GS, Link USB_ANALOGIC, Device 0, Input 2, PosL 97, PosC 133, PosR 170 // Potentiometer for Glideslope

To be on the safe side, I always explicitly specify the device numbers for each output device.

Hope this helps :)

Cheers,
Bobby

fordgt40
04-20-2012, 11:36 AM
Specifying the device is neater, but with only one dcmotors card it will always default to zero and its absence will not stop the card from working in these circumstances

Jack, a few questions - What sioc version are you using and I assume that your pot is connected to Input no 2, and that the motor turns?

David

Boeing 747 Flyer
04-20-2012, 12:09 PM
Hi David,

It's SIOC v4.0 (the latest version).

The motor definitely moves, and it's connected to input 2. I can see this using SIOC Monitor.

Cheers,

Jack

fordgt40
04-20-2012, 01:42 PM
Jack

So SIOC sees the USBDC card, moves the motor, but the pot, although rotating does not show any values in IOCPConsole. Yet, the pot does work when checked under Sioc Monitor.

Sorry to question you again, but are you certain that you are on input 2 - as I seem to recall a prob in the past with you discovering that the card pin headers are numbered in a strange way. If you have not yet tried this, test all card pot inputs

David

Boeing 747 Flyer
04-20-2012, 02:02 PM
Hi David,

I can 100% confirm that "Pot #2" when I double click the "DCMotors" option on the "SIOC Monitor" tab changes value when the motor moves. It does not, however, change value in IOCPConsole at all.

Does Pot #2 on SIOC Monitor correspond to something else?

Cheers,

Jack

fordgt40
04-20-2012, 02:31 PM
Jack

I prefer the physical approach and would test each input, ignoring what the monitor says:D
That way you will know for sure whether the pot is working within SIOC or not

David

Perik
04-20-2012, 02:51 PM
Hi Jack

Both your sioc.ini and script works at my end after adapting to my USB numbering.
I have only the Pot connected though and Var 3 is working nicely while turning the pot.

In Sioc monitor all A/D inputs changes if just one pot is connected.
The same seems to happen in SIOC as well - One pot connected, use any Input #.

In your script the motor will spin all the time - what kind of pot do you have? Multiturn?
And remember with your "PosL 97, PosC 133, PosR 170" you'll see
Var 3 change in just a small area.

I suggest you test just the pot (without motor) like David said.

Boeing 747 Flyer
04-20-2012, 09:09 PM
Alright. So I expanded the Pots "range" to 0 to 250 instead of 97 to 170.

SIOC's version of Input #2 is actually some random Pot stuck on value 247. Yet, in SIOC Monitor, Pot 2 is my glideslope Pot, which smoothly changes values when the motor moves.

So the problem is, "input 2" on monitor does not appear to be the same "input 2" in SIOC... Or so it seems.

Jack

fordgt40
04-21-2012, 04:05 AM
Have you tried connecting the pot to other inputs?
What type is the pot?
Try removing the device argument

David

Boeing 747 Flyer
04-21-2012, 10:33 AM
Hi David,

Ok, so I tried something totally outrageous and it worked.

In SIOC.ini, I called the USBDCMotors Card "Device 6" instead of "Device 0" (for now reason).

After referring to "Device 6" in the SIOC file; everythhing *appears* to work correctly! Interestingly however, the pot ranges from 0 to 255, not 97 to 173.

Cheers,

Jack

fordgt40
04-21-2012, 11:53 AM
Jack

Outrageous and illogical actions sometimes pay dividends :D The real problem now is to find out why it worked!

David

Perik
04-21-2012, 01:51 PM
Jack

I think I know why you see this. In the sioc.ini you two devices
both having USBAnalogic features - USBDCmotor and USBservos
Both are set to device index 0.
No problems as long as you use the main features (motor and servo)
but as soon as you start using pot's, you'll have trouble.
USBServo seems to take precedence over USBDCmotor pot's
and device index numbering. I don't know why but as usually
SIOC doc is pure crap in some area:-(

From your sioc.ini:
[USBDCMOTORS]
USBDCmotor=0,131

[USBDCMOTORSPOTS]
USBAnalogic=0,131

[USBSERVOS]
USBSERVOS=0,4

Try to either disconnect your USBServo board
or change the index to 1 and see what you get.

PS. I don't have USBServo connected at the moment so not able to test.

fordgt40
04-21-2012, 01:59 PM
Per-Erik

Of course, well done. I am shortly to programme my servo and dc motors cards for the throttle and was wondering how to differentiate the analogue inputs. Your suggestion sounds spot on

David