Results 21 to 30 of 69
-
05-21-2011, 06:02 AM #21
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
Hi Jack,
Almost correct...
- Your script lacks a parameter to the CALL of &Pulses ... You should write CALL &Pulses 5 or whatever the number you want to test.
- And you should add Up or Down counting in Var 2, before you call &Pulses.
BTW: Pulses, PulseDown and Finish belong together. You cannot and should not isolate Pulses.
regards,
Nico
-
05-21-2011, 01:17 PM #22
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
Hi Nico,
I used the following script; using two different pushbuttons for counting UP and DOWN. Each button produced exactly 10 pulses.
Code:Var 2 name Trigger Link IOCARD_SW Input 25 { IF &Trigger = 1 { &UPDOWN_Pin = 1 CALL &Pulses 10 } } Var 8 name Trigger2 Link IOCARD_SW Input 19 { IF &Trigger2 = 1 { &UPDOWN_Pin = 0 CALL &Pulses 10 } } Var 1 name Pulses link SUBRUTINE // parameter is number of pulses ... { &Out = 1 &PulseDown = DELAY &Pulses 5 // 50 msec for a half pulse } Var 3 name Out Link IOCARD_OUT Output 29 // Pulse Pin Var 11 name PulseDown { L0 = &PulseDown IF L0 > 0 { &Out = 0 &Finish = DELAY &PulseDown 5 // 50 msec for the other half of the pulse } } Var 12 name Finish { L0 = &Finish IF L0 > 0 { IF L0 > 1 { L0 = L0 - 1 CALL &Pulses L0 // recursive subroutine call } ELSE { &PulseDown = 0 // make responsive for another series of pulses. &Finish = 0 // make responsive for another series of pulses. } } } Var 55, name UPDOWN_Pin, Link IOCARD_OUT, Output 21 // Count UP or DOWN selector Pin
(Button X = UP, Y = DOWN)
- Pressed button X twice, HSI went to 20
- Press button Y once, HSI went to 11
- Pressed X once, went to 21
I reset the HSI using the reset pin.
- I pressed X once, went to 10
- Pressed Y once, went to 0
- Pressed X twice, went to 20
- Pressed Y once, went to 12
As you can see, it more or less goes up by exactly 10 each time. There is, however, a noticeable small margin of error counting down sometimes.
EDIT: After looking closely at the HSI display, I can confirm that when giving the first 10 pulses, the HSI display goes:
0000, 9999, 9998, 9999, 0000, 0001, 0002, 0003... Up to 0008
As you an see, the display goes DOWN by 2 values before counting 10 up... Which may explain the "lag" by 2 in pulses (explained in the above tests).
Also, I have found out that the display cannot be given two instructions at once. EG: If told to go up by 10 pulses, it MUST finish receiving 10 pulses before doing anything else. If told to go up by 10, and then 15, whilst it is still counting to 10, it will not go up by either 10 or 15 and get "confused".
Regards,
Jack
-
05-21-2011, 07:34 PM #23
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
Hi Nico,
I tried the DME_Full script again and frequently replicated the same problem.
Although, after tuning a VOR station that was 1.6nm away, the HSI showed 16 (1.6); it would never count down.
This is what IOCPConsole shows, after changing from 16 -> 15 (I have written it in the format you prefer). The following is listed in chronological order, it just tells you the value of each var as time goes on. The following all happened in about 5 seconds.
- New Distance = 15
- UPDOWN Pin = 1 (so as if we're going to count up??? Why?)
- CurrentD = 15
- Pulses = -1
- PulseDown = -1
- UPDOWN Pin = 0 (that's better, we can count down now)
- Pulses = 0
- PulseDown = 0
END
My concern is that SIOC is trying to do all the pulsing BEFORE it sets the UPDOWN_Pin to 0. Obviously, it cannot count down until this is set properly. Also, why is the pulses value -1? We can't have a -1 pulse?
Regards,
Jack
-
05-22-2011, 04:06 AM #24
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
-
05-22-2011, 04:12 AM #25
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
Jack,
You have to find out why this is. Maybe you need to build in some time between &UPDownPin = 1 and the Call of &Pulses?
Use 1 push button (Type P) to set the UPDOWN pin (according to the position of the button) . Use the other button to start the CALL of &Pulses 10
Good to know. In my control script this will not happen because it only generates a number of pulses per control cycle, either up or down. But maybe, see also my first comment, we need more delay.
Again: make this procedure (sending up/down pulses) 100% reliable before continuing...
regards,
NicoLast edited by kiek; 05-22-2011 at 04:19 AM.
-
05-22-2011, 09:34 AM #26
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
Hi Nico,
I have now finally figured out how to get a consistent value "10" on the HSI every time, without an erraneous results.
Basically, the pulse must START on 5V, and end on 5V. For example to count from 0-10:
- ON, OFF, ON, OFF, ON, OFF, ON, OFF, ON, OFF, ON, OFF, ON, OFF, ON, OFF, ON, OFF, ON, OFF, ON,
That's 11 "ONs" and 10 "OFFs". Doing this sequence consistantly gets 10 values exactly each time. The identical logic applies for counting down; you must START with 5V and END with 5V (with 11 ons and 10 offs).
I cannot seem to get a consistent enough result starting with an OFF.
In other words, all pulses must start with ON, and end with ON. If a pulse is finished with OFF, and starts with ON, then this in itself counts as a pulse and will give one extra value we don't need.
PS: All information was recorded using the following script:
Code:Var 99 name Trigger3 Link IOCARD_SW Input 18 Type P { IF &Trigger3 = 1 { &UPDOWN_Pin = 1 } } Var 98 name Trigger4 Link IOCARD_SW Input 23 Type P { IF &Trigger4 = 1 { &UPDOWN_Pin = 0 } } Var 2 name Trigger Link IOCARD_SW Input 25 Type P { IF &Trigger = 1 { CALL &Pulses 10 } } Var 1 name Pulses link SUBRUTINE // parameter is number of pulses ... { &Out = 1 &PulseDown = DELAY &Pulses 9 // 50 msec for a half pulse } Var 3 name Out Link IOCARD_OUT Output 29 // Pulse Pin Var 11 name PulseDown { L0 = &PulseDown IF L0 > 0 { &Out = 0 &Finish = DELAY &PulseDown 9 // 50 msec for the other half of the pulse } } Var 12 name Finish { L0 = &Finish IF L0 > 0 { IF L0 > 1 { L0 = L0 - 1 CALL &Pulses L0 // recursive subroutine call } ELSE { &PulseDown = 0 // make responsive for another series of pulses. &Finish = 0 // make responsive for another series of pulses. } } } Var 55, name UPDOWN_Pin, Link IOCARD_OUT, Output 21 // Count UP or DOWN selector Pin
Regards,
Jack
-
05-22-2011, 10:25 AM #27
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
Hi Jack,
Good work.
I have changed the subrutine Pulses such that in 'rest' Out will be 1. Also added a Var 0 in order to be able to start with Out = 1
Code:Var 0 Value 0 { &Out = 1 } Var 99 name Trigger3 Link IOCARD_SW Input 18 Type P { IF &Trigger3 = 1 { &UPDOWN_Pin = 1 } } Var 98 name Trigger4 Link IOCARD_SW Input 23 Type P { IF &Trigger4 = 1 { &UPDOWN_Pin = 0 } } Var 2 name Trigger Link IOCARD_SW Input 25 Type P { IF &Trigger = 1 { CALL &Pulses 10 } } Var 1 name Pulses link SUBRUTINE // parameter is number of pulses ... { &Out = 0 &PulseUp = DELAY &Pulses 9 // 50 msec for a half pulse } Var 3 name Out Link IOCARD_OUT Output 29 // Pulse Pin Var 11 name PulseUp { L0 = &PulseUp IF L0 > 0 { &Out = 1 &Finish = DELAY L0 9 // 50 msec for the other half of the pulse } } Var 12 name Finish { L0 = &Finish IF L0 > 0 { IF L0 > 1 { L0 = L0 - 1 CALL &Pulses L0 // recursive subroutine call } ELSE { &PulseUp = 0 // make responsive for another series of pulses. &Finish = 0 // make responsive for another series of pulses. } } } Var 55, name UPDOWN_Pin, Link IOCARD_OUT, Output 21 // Count UP or DOWN selector Pin
Nico
-
05-22-2011, 10:57 AM #28
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
Hi Nico,
Great news! That script ensures that it goes up EXACTLY by 10 or down by 10 each time. The trick seems to be starting on 5V and ending on 5V.
There is just one problem. As you know, as SIOC is started it resets all outputs connected to the mastercard.
Var 0 turns the range display to 5V. So, in other words, the range display = 0 for a very, very short time, before var 0 sets it to 5V. This very short OFF/On sequence, even if it is for a billionth of a second, counts as a pulse, so the HSI display counts down one.
We need to get rid of this initial OFF/ON pulse.
Also, some more good news: the script even works when transitioning from an UP to a DOWN count EG: 10-20, then back down to 10 is no problem.
Regards,
Jack
-
05-22-2011, 11:42 AM #29
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
-
05-22-2011, 11:56 AM #30
Re: HSI Pulse Range Counter Display - How to manipulate in SIOC?
Hi Nico,
Fantastic news! We have bypassed stage 1. All is working!
I did, however, have to change the script slightly. Firstly, the error was a DOWN pulse (it went from 0 to 9999) so the UPDOWN_Pin had to be 1. Secondly, and I don't know why, &Pulses must be called TWICE to compensate for the error:
Code:Var 0 Value 0 { &Out = 1 &UPDOWN_Pin = 1 // count down CALL &Pulses 2 // correct for first OFF/ON pulse at startup } Var 99 name Trigger3 Link IOCARD_SW Input 18 Type P { IF &Trigger3 = 1 { &UPDOWN_Pin = 1 } } Var 98 name Trigger4 Link IOCARD_SW Input 23 Type P { IF &Trigger4 = 1 { &UPDOWN_Pin = 0 } } Var 2 name Trigger Link IOCARD_SW Input 25 Type P { IF &Trigger = 1 { CALL &Pulses 10 } } Var 1 name Pulses link SUBRUTINE // parameter is number of pulses ... { &Out = 0 &PulseUp = DELAY &Pulses 9 // 50 msec for a half pulse } Var 3 name Out Link IOCARD_OUT Output 29 // Pulse Pin Var 11 name PulseUp { L0 = &PulseUp IF L0 > 0 { &Out = 1 &Finish = DELAY L0 9 // 50 msec for the other half of the pulse } } Var 12 name Finish { L0 = &Finish IF L0 > 0 { IF L0 > 1 { L0 = L0 - 1 CALL &Pulses L0 // recursive subroutine call } ELSE { &PulseUp = 0 // make responsive for another series of pulses. &Finish = 0 // make responsive for another series of pulses. } } } Var 55, name UPDOWN_Pin, Link IOCARD_OUT, Output 21 // Count UP or DOWN selector Pin
Woohoo!
Jack
Candid connections: Platform for casual relationships Live Women Prime Сasual Dating
Super Сasual Dating - Genuine...