View Full Version : USBSteppers Card!
Boeing 747 Flyer
09-23-2011, 06:43 PM
Hiya all,
I am trying to set the OC USBSteppers Card up. I have two Bi-Polar motors connected to the card.
This is the script I'm using:
Var 0011, Link USB_STEPPER, Output 2, PosL 6, PosC 0, PosR 4, Type T
Var 0002, name Step3, Link USB_STEPPER, Output 3, PosL 6, PosC 0, PosR 4
Var 0001, name Step1, Link USB_STEPPER, Output 1, PosL 6, PosC 0, PosR 4
Var 0112, name Switch7, Link IOCARD_SW, Input 222 // EVAC Toggle Switch
{
IF &Switch7 = 1
{
&Step1 = 180
&Step3 = 180
}
ELSE
{
&Step1 = 255
&Step3 = 255
}
}
It's just a simple script that changes the speed of the motor based upon a switch press.
However, whilst an output is definitely provided to the Stepper Motors, I just get a jerky, unstable movement from the Stepper Motor.
The manual suggests this could be the motor itself, but after inspecting it AND trying a different motor I get the same results.
Also, after testing with a multimeter, it is clear that pins 3 and 4 on "block 1" of the 5 pin connectors do not have any sort of output going to them; which is obviously useless if trying to get a BiPolar motor to work!
If anyone has any ideas at all, please tell me what I've done wrong.
Cheers,
Jack
JACK,
Have you set up the iostepper.ini file?. Does the stepper self calibrate properly.That is when you power it up and run IOstepper.exe the motor should spin and pass the sensor once then stop at the sensor on the second pass,does it do that correctly?. If this is correct run the script they provide as an example in the manual,it works fine.
Les
Boeing 747 Flyer
09-25-2011, 05:42 AM
Hiya Les,
Could you please tell me where the IOStepper.ini file is? The only reference I can find to any sort of ini file in the manual is SIOC.ini, which I have already set up correctly.
Cheers,
Jack
fordgt40
09-25-2011, 07:07 AM
Jack
Apparently there are two manuals :roll:
The one IWIK is referring to must be the manual which can be downloaded from the "shop" page where it says about halfway down
CARD CONFIGURATION
Card is configured with the file IOCStepper.ini
etc etc etc
The other manual which is amongst a whole page of manuals, does not I think mention the .ini file:roll:
Suppose you could try both versions :)
Regards
David
Edited for correction as there are two manuals
Hi Jack,
Just got up this morning and saw your message.
Here is the link, and is what i used to test my software. Im not sure exactly how one is supposed to run the stepper. Before the latest sioc v4.0 it had been said that this software was not needed as it was built in to Sioc but had read people had trouble getting the stepper to work. So any testing ive done and i used the example to drive the compass from Fsim was to run iostepper.exe after setting the .ini file and then run at the same time sioc.exe with your script.
Here is the link.
http://www.opencockpits.com/modules.php?name=Content2&pa=showpage&pid=53
Hope thsi helps.
Les
Boeing 747 Flyer
09-25-2011, 03:01 PM
Thank you everyone!
After finding that second manual, I now have the Stepper motor running.
But that's all I can get it to do; literally, just keep turning clockwise forever until I turn it off. I can adjust the speed slightly through the tweaking of the various .ini files and SIOC, but none are slow enough for my needs.
I'm trying to use the Stepper motor as a Chronograph (ie synconise with the FS aircraft's clock). Are there any scripts for this like there is for Compass scripts?
If it helps, the motor has 24 Steps per 360 degree turn, and it's Bi-Polar. It is set up in accordance to the OC manual for Bi-Polar motor and works well, but as you can see I can't really control it.
I have absolutely zero experience with Stepper motors hence the post!
Jack
fordgt40
09-25-2011, 03:20 PM
Are there any scripts for this like there is for Compass scripts?
Jack
Here you are courtesy of Carlos Lopez.
Edit Just ran through the code again and noticed that it is IOCP based, however, may give you a starter for ten. Looks daunting though :)
Regards
David
// *****************************************************************************
/ / * Config_SIOC see 3.5 - By Manolo Velez - www.opencockpits.com
// *****************************************************************************
/ / * FileName: clock-Cronometro.txt
/ / * Date: 20/01/2009
// *****************************************************************************
// -----------------------------------------------------------------------------
/ / Script developed by Carlos Lopez
//
//
/ / This clock stopwatch, based on the functioning available in the B737NG
/ / two 4-digit each display. In the upper visualizamos year, month and day
/ / or time in HH.MM or MM.SS, changing between These 4 options with the button
/ / TIME / DATE. Likewise the SET button activates the the digits flicker to modify them
/ / using the buttons + and -, so it's not must enter the FS to modify
/ / date or time, but we can do directly from here,
/ / updated automatically on the FS.
//
/ / In this Script I'm not using any timer mode to own the FS clock
/ / is which will give the clock pulse to East Reloj-Cronómetro function.
/ / For this, the script rotates surrounding to the operation of offset 4 of the IOCP
/ / stores the data of the second FS clock.This is true, because I have seen
/ / to open any the FS menu option it for the clock, so it
/ / mode, always our clock always displayed the exact data of the FS.
/ / For this, has been created a general variable which provides various States
/ / di visualization of the displays. Therefore, in Depending on the value of that variable
/ / will act as the script. These are the different States of the Time_Date_Year variable
//
/ / Time_Date_Year = 0
/ / Time_Date_Year = 1 Visualizo year
/ / Time_Date_Year = 2 Visualizo day and month
/ / Time_Date_Year = 3 Visualizo the Zulu time
/ / Time_Date_Year = 4 Visualizo minutes and Seconds
//
/ / To modify the date or time, be pondran in intermittent decimal points of each
/ / digit. These connected are decimal points to two outputs of displays, using any of
/ / its segments so depending on of the value give that digit, is encenderán
/ / and/or apagarán corrrespondientes segments and by both the decimal points.
/ / Thus the use of outputs we ourselves save of the Master and cabling towards different connectors
/ / of the Master. I have connected the two points the two-digit left decimals to
/ / an output displays (exit 4) and the other two the right to another output points
/ / display (exit 5).
/ / Digits turn for each decimal point are:
/ / If we send a 9 to the 4 output ignited the two the two-digit left points.
/ / If we send a 7 exit 4 turns on the point the 2, which would be the hundreds digit.
/ / If we send a 9-5 exit ignited the two the two-digit right points.
//
/ / Notice you turn on the point of the 2 digit for separate minutes, hours minutes
/ / the seconds or the day of month, depending on what that we are seeing.
//
/ / We have two buttons for the control of the lower displays. The active CHR button
/ / timer and button ET Elapsed Time or time partial.
//
/ / CHR function. By clicking its button glows a led beside the push button that shows us that the
/ / see in the display is the stopwatch. The second time that click we started. The third
/ / stop it and so forth. If we want to put it to zero, click the RST button. The information
/ / us shows in format mm:SS and when we come to 59: 59 again start timer from zero.
//
/ / Function ET. By clicking its button glows a led beside the push button that shows us that the
/ / see in the display is the time Elapsed. The second time that click we started. The third
/ / stop it and so forth. If we want to put it to zero, click the RST button. Information is
/ / shows us format mm:SS during the first minute, then we see it in format HH_MM.
//
/ / To indicate in the lower display we see the Stopwatch (CHR) or Elapsed Time (ET) we use
/ / two LEDs next to each of the buttons activated. Also save outputs
/ / of the Master, we use a card connector of dispalys so according to the number that
/ / represent, will be one of the power leds.
/ / If we are sending a 2 to display 14 glows led of the CHR to connected to the 5 pin connector
/ / If we send a 5 to 14 display turns the led from the ET that connected with pin 2 of the connector
//
//
/ / The modification of the date takes into account If the year is leap or not, so that for
/ / know more about the calculation of the leap year:
//
/ / http://es.wikipedia.org/wiki/A%C3%B1o_bisiesto
/ / http://es.wikipedia.org/wiki/Algoritmo_bisiesto
/ / http://upload.wikimedia.org/wikipedia/commons/2/27/Graf_algo_bisiesto.PNG
//
// -----------------------------------------------------------------------------
0000 Var, Value 0 / / Inicializacion of values of variables
{
&Time_Date_Year = 2
&Disp_Year = & Zulu_Year_Set
&Year_to_Modif = & Zulu_Year_Set / / We pass the year to an internal vble
&Modif_Year = 0
&Disp_DWN_Pnt = 1
&Estado_CHR = 0
&CHR_ET_ToDisp = 0
&Disp_CHR_ET = - 999999 / / Apagamos the Indicators LEDs of CHR-ET
&Aguja_Segundos = 9000 / / move the the seconds to 15 needle to view the displays better
}
//
// -----------------------------------------------------------------------------
//
/ / OWN VARIABLES
//
// -----------------------------------------------------------------------------
//
Var 0010, name Time_Date_Year / / index for digit Time-date-Year
Var 0012, name Modif_Year / / we activate control modification year. 0 = Descativado, 1 = enabled
Var 0014, name Modif_DDMM / / we activate control modification Dia.Mes-> 0 = Descativado, 1 = month 2 = day
Var 0016, name Year_to_Modif / / Guarda year for modify
Var 0018, name DD_to_Modif / / saves the day for modify
Var 0020, name MM_to_Modif / / saves the month for modify
Var 0022, name CHR_ET_ToDisp / / controls if we see the CHR or the ET in the lower display. 0 = CHR 1 = ET
Var 0024, name CHR_Min / / accumulates the minutes of the cronometro
Var 0026, name CHR_Sec / / accumulates the second of the cronometro
Var 0028, name Estado_CHR / / monitors the status of the CHR button. 0-> Pone crystals in display
// 2 -> Inicia CHR o continúa
// 3 -> STOP timer.
Var 0030, name ET_Hr / / accumulates the hours from the ET (Elapsed Time)
Var 0032, name ET_Min / / accumulates the minutes of the ET (Elapsed Time)
Var 0034, name ET_Sec / / accumulates the second of the ET (Elapsed Time)
Var 0036, name Estado_ET / / monitors the status of the Button ET. 0-> Pone ET display
// 2 -> Start ET or continues
// 3 -> STOP ET
Var 0037, name Limit_DD_Mes / / stores the total of days that has active month
Var 0038, name DayofYear / / stores the day of the year
Var 0039, Aguja_Segundos, USB_STEPPER, Output Link name 3, PosL 6, 0 PosC, PosR 4, Type H
// -----------------------------------------------------------------------------
//
/ / VARIABLES IOCP
//
// -----------------------------------------------------------------------------
Var 0050, name Clock_Seconds, IOCP Link, offset 4 / / FS clock seconds
{
IF & Time_Date_Year = 1 / / Visualizo year
{
IF & Modif_Year = 1 / / if we are in control of the year activation
{
&Disp_Pnt_Up_I = 9 / / Switch points of the year digits
&Disp_Pnt_Up_D = 9 / / Switch points of the year digits
&Disp_Pnt_Up_I = Delay - 999999 50 / / and the Apagamos with a half second delay
&Disp_Pnt_Up_D = Delay - 999999 50 / / and the Apagamos with a half second delay
}
}
IF & Time_Date_Year = 2 / / Visualizo day and month
{
IF & Modif_DDMM = 1 / / if we are in the modification month control activation
{
&Disp_Pnt_Up_D = 9 / / Switch points of the month digit
&Disp_Pnt_Up_D = Delay - 999999 50 / / and the Apagamos with a half second delay
}
IF & Modif_DDMM = 2 / / if we are in the modification day control activation
{
&Disp_Pnt_Up_I = 9 / / Switch points of the day digit
&Disp_Pnt_Up_I = Delay - 999999 50 / / and the Apagamos with a half second delay
}
}
IF & Time_Date_Year = 3 / / Visualizo time Zulu
{
CALL & Show_Display
}
IF & Time_Date_Year = 4 / / Visualizo minutes and second
{
CALL & Show_Display
}
If & Estado_CHR = 2 / / 2-> starts CHR or continues
{
&CHR_Sec = & CHR_Sec + 1
If & CHR_Sec > 59
{
&CHR_Sec = 0
&CHR_Min = & CHR_Min + 1
If & CHR_Min > 59 / / when We come to 1 hour zeros
{
&CHR_Min = 0
}
}
&Aguja_Segundos = & CHR_Sec * 600 / / Move the needle of the seconds if the CHR this working
}
If & Estado_ET = 2 / / 2-> starts ET or continues
{
&ET_Sec = & ET_Sec + 1
If & ET_Sec > 59
{
&ET_Sec = 0
&ET_Min = & ET_Min + 1
If & ET_Min > 59
{
&ET_Min = 0
&ET_Hr = & ET_Hr + 1
}
}
}
If & CHR_ET_ToDisp = 0 / / show the CHR in the lower displays
{
Call & Ver_CHR
}
else / / show the ET on the lower displays
{
Call & Ver_ET
}
}
Var 0052, name Zulu_Hour, IOCP Link, offset 5 / / time Zulu. Reading and writing
{
CALL & Show_Display
}
Var 0054, name Zulu_Minute, IOCP Link, offset 6 / / Minutes Zulu. Reading and writing
{
CALL & Show_Display
}
Var 0056, name Day_of_Year, IOCP Link, offset 7 / / Number of the day of the year. Reading and writing. Number days total per year
Var 0058, name Day_of_Month, IOCP Link, offset 743 / / Day of the corresponding month. Read-only
{
CALL & Show_Display
}
Var 0060, name Current_Month, IOCP Link, offset 744 / / number of the month. Read-only
{
CALL & Show_Display
}
Var 0062, name Zulu_Year_Set, IOCP Link, offset 8 / / Year. Reading and writing
{
&Year_to_Modif = & Zulu_Year_Set
Call & Chk_Bisiesto / / Check whether is a leap
}
// -----------------------------------------------------------------------------
//
/ / VARIABLES IOCARDS - DISPLAYS -
//
// -----------------------------------------------------------------------------
Var 0100, name Disp_Year, IOCARD_DISPLAY Link, Digit 0, Numbers 4 / / UP Displays Year
Var 0101, name Disp_Day_Hour, IOCARD_DISPLAY Link, Digit 2, Numbers 2 / / UP Displays Day or Hour
Var 0102, name Disp_Month_Min, IOCARD_DISPLAY Link, Digit 0, Numbers 2 / / UP Displays Month or minutes
Var 0104, name Disp_DWN_Min, IOCARD_DISPLAY Link, Digit 11, Numbers 2 / / Down Displays CHR - ET-> Min
Var 0105, name Disp_DWN_Sec, IOCARD_DISPLAY Link, Digit 9, Numbers 2 / / Down Displays CHR - ET-> Sec
Var 0110, name Disp_Pnt_Up_I, IOCARD_DISPLAY Link, Digit 4, Numbers 1 / / point decimal UP Displays
Var 0111, name Disp_Pnt_Up_D, IOCARD_DISPLAY Link, Digit 5, Numbers 1 / / points decimals UP Displays
Var 0112, name Disp_DWN_Pnt, IOCARD_DISPLAY Link, Digit 8, Numbers 1 / / point decimal Down Displays
Var 0114, name Disp_CHR_ET, IOCARD_DISPLAY Link, Digit 14, Numbers 1 / / be connecting indicators LEDs CHR/ET
// -----------------------------------------------------------------------------
//
/ / VARIABLES IOCARDS - TICKETS -
//
// -----------------------------------------------------------------------------
//
Var 0120, name SW_Time_Date, IOCARD_SW Link, Input 4, Type P / /----------------------------------> button TIME-DATE
{
IF & Modif_Year = 0 / / if not we are in the year-Set (SET button) control activation
{
&Time_Date_Year = & Time_Date_Year + 1
IF & Modif_DDMM > 0 / / if I am modifying day month or month
{
&Modif_DDMM = 0
}
}
IF & Time_Date_Year > 4 / / check if We exit of margin
{
&Time_Date_Year = 1 / / put to 1
}
Call & Show_Display / / show in Displays the corresponding data
If & Estado_CHR = 3 / / If the CHR this stopped
{
&Aguja_Segundos = 9000 / / move the seconds to 15 needle to view the displays better
}
}
Var 0122, name SW_SET, IOCARD_SW Link, Input 2, Type P // ----------------------------------> Botón SET
{
IF & Time_Date_Year = 1 / / If I am viewing the year
{
IF & Modif_Year = 0 / / If I am not modifying the year
{
&Modif_Year = 1 / / We activate control modification year
&Year_to_Modif = & Zulu_Year_Set / / we pass the year to a vble to modify
}
else
{
Call & Chk_Bisiesto / / Check whether is a leap
call & calc_DayofYear
&Day_of_Year = &DayofYear / / we echo back the day to FS you change it
&Modif_Year = 0 / / Disable control modification year
&Zulu_Year_Set = & Year_to_Modif / / Echo the year to the FS you change it
Call & Show_Display / / We show the year
}
}
IF & Time_Date_Year = 2 / / if I am viewing the month day and month (DD.MM)
{
IF & Modif_DDMM = 0 / / if not I am modifying day of month and the month
{
&Modif_DDMM = 1 / / We activate control modification month
&MM_to_Modif = & Current_Month / / we pass the month to a vble to modify
&Disp_Pnt_Up_I = - 999999 / / Apagamos the points of the day digit
}
else
{
IF & Modif_DDMM = 1 / / if We are modifying the month we come to modify the day
{
Call & Chk_DiasDelMes / / calculate few days has the month we modified
&Modif_DDMM = 2 / / We activate control modification day
&DD_to_Modif = &Day_of_Month / / we spent the day to a vble to modify
&Disp_Pnt_Up_D = -999999 / / Apagamos points of the month digit
}
else / / we ended up of modified so that we send values to the FS
{
call & calc_DayofYear
&Day_of_Year = & DayofYear / / We echo back the day to FS you change it
&Disp_Pnt_Up_I = - 999999 / / Apagamos the points of the day digit
&Disp_Pnt_Up_D = -999999 / / Apagamos points of the month digit
&Disp_Pnt_Up_I = 7 / / switch the separator point of DD and MM
&Modif_DDMM = 0
call & Show_Display
}
}
}
}
Var 0124, name SW_CHR, IOCARD_SW Link, Input 3, Type P // ----------------------------------> Botón CHR
{
&Disp_CHR_ET = 2 / / switch the the CHR indicator led
Call & Ver_CHR
If & CHR_ET_ToDisp = 1 / / we have been from the ET function
{
&CHR_ET_ToDisp = 0 / / Acivamos control over the display to CHR
}
else / / already were in the CHR function
{
&Estado_CHR = & Estado_CHR + 1 / / Change the CHR State
}
If & Estado_CHR > 3 / / Check limit of the State of the CHR
{
&Estado_CHR = 2 / / 2-> Start CHR or continues 3-> STOP timer.
}
}
Var 0125, name SW_ET, IOCARD_SW Link, Input 6, Type P // ----------------------------------> Botón ET
{
&Disp_CHR_ET = 5 / / switch the indicator led from the ET
Call & Ver_ET
If & CHR_ET_ToDisp = 0 / / we have been of the CHR function
{
&CHR_ET_ToDisp = 1 / / Acivamos control over the display for ET
}
else / / already were in the function ET
{
&Estado_ET = & Estado_ET + 1 / / Change state ET
}
If & Estado_ET > 3 / / check limit of the State of the ET
{
&Estado_ET = 2 / / 2-> Start ET or continues 3-> STOP ET
}
}
Var 0126, Link IOCARD_SW, 7 Input Type P // ----------------------------------> Botón RST
{
If & CHR_ET_ToDisp = 0
{
&CHR_Min = 0 / / zero the minutes of the CHR
&CHR_Sec = 0 / / zero the seconds of the CHR
&Aguja_Segundos = 0
Call & Ver_CHR
}
else
{
&ET_Hr = 0 / / zero the the ET time
&ET_Min = 0 / / zero the the ET minutes
&ET_Sec = 0 / / zero the the ET seconds
Call & Ver_ET
}
}
Var 0127, Link IOCARD_SW, Input 5, Type P / /----------------------------------> button +
{
IF & Modif_Year = 1 / / if we are in control of the year activation
{
&Year_to_Modif = & Year_to_Modif + 1
&Disp_Year = & Year_to_Modif
}
IF & Modif_DDMM = 1 / / if we are in activation of the month control
{
&MM_to_Modif = & MM_to_Modif + 1
If & MM_to_Modif > 12
{
&MM_to_Modif = 1
}
&Disp_Month_Min = & MM_to_Modif
}
IF & Modif_DDMM = 2 / / if we are in the control of the day of activation
{
&DD_to_Modif = & DD_to_Modif + 1
If & DD_to_Modif > & Limit_DD_Mes
{
&DD_to_Modif = 1
}
&Disp_Day_Hour = & DD_to_Modif
}
}
Var 0128, Link IOCARD_SW, Input 1, Type P / /----------------------------------> button -
{
IF & Modif_Year = 1 / / if we are in control of the year activation
{
&Year_to_Modif = & Year_to_Modif - 1
&Disp_Year = & Year_to_Modif
}
IF & Modif_DDMM = 1 / / if we are in activation of the month control
{
&MM_to_Modif = & MM_to_Modif - 1
If & MM_to_Modif < 1
{
&MM_to_Modif = 12
}
&Disp_Month_Min = & MM_to_Modif
}
IF & Modif_DDMM = 2 / / if we are in the control of the day of activation
{
&DD_to_Modif = & DD_to_Modif - 1
If & DD_to_Modif < 1
{
&DD_to_Modif = & Limit_DD_Mes
}
&Disp_Day_Hour = & DD_to_Modif
}
}
//
// -----------------------------------------------------------------------------
//
/ / SUBROUTINES
//
// -----------------------------------------------------------------------------
//
Var 0200, Show_Display, SUBRUTINE Link name / / Displays the year
{
&Disp_Pnt_Up_I = - 999999 / / Apagamos the separator point
&Disp_Pnt_Up_D = - 999999 / / Apagamos the separator point
IF & Time_Date_Year = 1 / / Visualizo year
{
&Disp_Year = - 999999 / / Apagamos the year
&Disp_Year = & Zulu_Year_Set
}
IF & Time_Date_Year = 2 / / Visualizo day and month
{
&Disp_Day_Hour = & Day_of_Month
&Disp_Month_Min = & Current_Month
&Disp_Pnt_Up_I = 7
}
IF & Time_Date_Year = 3 / / Visualizo time Zulu and minutes
{
&Disp_Day_Hour = & Zulu_Hour
&Disp_Month_Min = & Zulu_Minute
&Disp_Pnt_Up_I = 7
}
IF & Time_Date_Year = 4 / / Visualizo minutes and second
{
&Disp_Day_Hour = & Zulu_Minute
&Disp_Month_Min = & Clock_Seconds
&Disp_Pnt_Up_I = 7
}
}
Var 0202, Ver_CHR, SUBRUTINE Link name / / go CHR to display
{
&Disp_DWN_Min = & CHR_Min / / We show the minutes of the CHR in display Down
&Disp_DWN_Sec = & CHR_Sec / / We show the minutes of the CHR in display Down
}
Var 0204, Ver_ET, SUBRUTINE Link name / / go ET to the display
{
If & ET_Min = 0 / / during the first first minute show mm:SS
{
&Disp_DWN_Min = & ET_Min / / We show the minutes of the Te in display Down
&Disp_DWN_Sec = & ET_Sec / / We show the seconds of the Te in display Down
}
else / / after of the first minute We show hh: mm
{
&Disp_DWN_Min = & ET_Hr / / We show the time of the Te in display Down
&Disp_DWN_Sec = & ET_Min / / We show the minutes of the Te in display Down
}
}
Var 0206, Chk_Bisiesto, SUBRUTINE Link name / / check if the year is bisisesto
{
L0 = MOD & Zulu_Year_Set, 4 / / L0 accumulates the rest of the Division
IF L0 = 0
{
&Chk_Bisiesto = 1 / / no Leap = 0 leap = 1
}
ELSE
{
L0 = MOD & Zulu_Year_Set, 400
IF L0 = 0
{
L0 = MOD & Zulu_Year_Set, 100
IF L0 <> 0
{
&Chk_Bisiesto = 1 / / no Leap = 0 leap = 1
}
ELSE
{
&Chk_Bisiesto = 0 / / no Leap = 0 leap = 1
}
}
ELSE
{
&Chk_Bisiesto = 0 / / no Leap = 0 leap = 1
}
}
}
Var 0208, Chk_DiasDelMes, SUBRUTINE Link name / / Estimated few days have the month
/ / 31 days have JAN, SEA, MAY, JUL, AUG, OCT, DEC
/ / 30 days have APR, JUN, SEP, NOV
/ / 28 days has FEB except the leap that has 29
{
If & MM_to_Modif = 1 / / ENE
{
&Limit_DD_Mes = 31
}
If & MM_to_Modif = 2 / / FEB
{
If & Chk_Bisiesto = 0 / / if it is not leap
{
&Limit_DD_Mes = 28
}
else / / if it is a leap
{
&Limit_DD_Mes = 29
}
}
If & MM_to_Modif = 3 / / MAR
{
&Limit_DD_Mes = 31
}
If & MM_to_Modif = 4 / / ABR
{
&Limit_DD_Mes = 30
}
If & MM_to_Modif = 5 / / MAY
{
&Limit_DD_Mes = 31
}
If & MM_to_Modif = 6 / / JUN
{
&Limit_DD_Mes = 30
}
If & MM_to_Modif = 7 / / JUL
{
&Limit_DD_Mes = 31
}
If & MM_to_Modif = 8 / / AGO
{
&Limit_DD_Mes = 31
}
If & MM_to_Modif = 9 / / SEP
{
&Limit_DD_Mes = 30
}
If & MM_to_Modif = 10 / / OCT
{
&Limit_DD_Mes = 31
}
If & MM_to_Modif = 11 / / NOV
{
&Limit_DD_Mes = 30
}
If & MM_to_Modif = 12 / / DIC
{
&Limit_DD_Mes = 31
}
}
Var 0210, Calc_DayofYear, SUBRUTINE Link name / / Calculates the day of the month in relation to the full year
/ / / / As well the ENE is 1 the calc_DayofYear = 1 and the
/ / / / Dec 31 is the 365 except leap which is the 366
{
If & MM_to_Modif = 1 / / JAN 31
{
&DayofYear = & DD_to_Modif / / Step to Calc_DayofYear the day of the month of January
}
If & MM_to_Modif = 2 / / 28 FEB
{
&DayofYear = & DD_to_Modif + 31 / / Agree me with the days of the month of the previous month
}
If & MM_to_Modif = 3 / / SEA 31
{
&DayofYear = & DD_to_Modif + 59 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif = 4 / / APR 30
{
&DayofYear = & DD_to_Modif + 90 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif = 5 / / MAY 31
{
&DayofYear = & DD_to_Modif + 120 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif = 6 / / JUN 30
{
&DayofYear = & DD_to_Modif + 151 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif = 7 / / JUL 31
{
&DayofYear = & DD_to_Modif + 181 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif = 8 / / AUG 31
{
&DayofYear = & DD_to_Modif + 212 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif = 9 / / SEP 30
{
&DayofYear = & DD_to_Modif + 243 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif = 10 / / OCT 31
{
&DayofYear = & DD_to_Modif + 273 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif = 11 / / NOV 30
{
&DayofYear = & DD_to_Modif + 304 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif = 12 / / DEC 31
{
&DayofYear = & DD_to_Modif + 334 / / Agree me with the days of the month from previous months
}
If & MM_to_Modif > 1
{
If & Chk_Bisiesto = 1 / / if it is leap
{
&DayofYear = & DayofYear + 1
}
}
}
Jack,
Have you fitted an optical sensor and flag to your stepper. In case you dont know, you have to fit a little flag to the shaft of the stepper and this has to be adjusted to pass betweenan optical sensor to break a light source. Thsi tell the stepper where it is. When you first power up a stepper it will do one complete rev and then stop with the flag in the sensor. You have an input to stepper board from the sensor for each motor.
Have you done this ,its explained in the manual i directed you to. To test if your sensor is ok. Place your meter on the sensor input to the stepper bd and rotate the flag in and out of the sensor.Thew meter should go between 5v and ov as the beam is interrupted..
If your motor is continually turning then this sensor input is not working.
Let us know how you get on.
Les
P.s The motor should turn and stop as soon as you run IOsteoer.exe. No code has to be run.
Boeing 747 Flyer
09-26-2011, 07:41 AM
Hi Les/David,
I do not have any sort of Optical sensor installed. I wsa under the impression Stepper Motors could be operated open-loop.
Is the optical sensor a DIY job or should it be purchased from somewhere? Are there any pictures available for my specific application?
Cheers,
Jack
fordgt40
09-26-2011, 08:29 AM
Jack
READ THE FRIENDLY MANUAL :)
There is a picture of the sensor and a rs online part number 304-560
Regards
David
Jack,
A stepper i think still needs to know where to start from. This is why at startup it always does one revolution and then stops. Im afraid o/c stepper needs this sensor. Even if it doesnt have a sensor it still needs something like a home switch to tell it where to starty counting from.
Just follow the manual and you cant go wrong. We are here when you get stuck.
Also suggest when you have done this use the Compass example to test, i can verify it works.
Les
Boeing 747 Flyer
09-26-2011, 05:18 PM
Thanks for the replies Les & David.
That EXACT optical sensor is being fitted to my setup as I type (I had one lying around).
Once fitted, I take it the first thing to do is run IOStepper.exe and see if it does a 360 degree turn and then stops?
Also, as an extra note, I made this script:
Var 0112, name Switch7, Link IOCARD_SW, Input 222 // EVAC Toggle Switch
{
IF &Switch7 = 1
{
&BlinkLed = 60 // begin value of timer
&BlinkLed = TIMER 0 -1 100
}
}
Var 0001, Link USB_STEPPER, name Chrono, Output 1, PosL 255, PosC 24, PosR 4, Type H
Var 6, name BlinkLed
{
L0 = &BlinkLed
L1 = 60 - L0
&Final_Value = L1
}
Var 7, name Final_Value
{
L0 = &Final_Value * 0.6
&Final_Chrono = L0
&Final_Deg = &Final_Chrono * 10
}
Var 8, name Final_Chrono
Var 9, name Final_Deg // This is the EXACT degree value of the Chronograph - IE: When Final_Value = 15s, Final_Deg = 90 degrees
Basically, a 60 second (which is what a Boeing chronograph represents) timer is triggered by a switch flick. Then, through numerous calculations, we can use the "Final_Deg" value to tell the Stepper motor where to go.
For example, after 15 seconds, the needle will have moved exactly a quarter around the display. As such, Final_Deg will equal 90.
Cheers,
Jack
fordgt40
09-26-2011, 05:58 PM
Jack
Quick progress :)
Perhaps I am having another senior moment, but I do not see in your example any code to make the stepper actually move? Perhaps the stepper name is wrong as it is not referenced anywhere else in your code?
Good luck
Regards
David
Boeing 747 Flyer
09-27-2011, 03:27 AM
Hi David,
The script is just to calculate the degree of movement agsinst seconds elapsed. I haven't done any script to interface to the actual motor yet (I don't even know how yet!).
Jack
fordgt40
09-27-2011, 04:27 AM
Jack
Ok :)
If you run config_sioc and look up usb stepper in the Help section there is a full explanation of the parameters to set for the stepper motor. You just then assign a variable to it and send the values to make it move.
Regards
David
737NUT
09-27-2011, 09:00 AM
Hello,
This is all you need for your project! It is what I use to drive my real Boeing clock which has stepper motors. Only 19.95!!
http://www.pololu.com/catalog/product/1183 Drives it in open loop mode in continuous rotation.
Rob
Boeing 747 Flyer
09-27-2011, 05:54 PM
Hello,
This is all you need for your project! It is what I use to drive my real Boeing clock which has stepper motors. Only 19.95!!
http://www.pololu.com/catalog/product/1183 Drives it in open loop mode in continuous rotation.
Rob
Thanks for the advice Rob!
Unfortunately, things aren't looking good for the USBStepper Motors Card.
I installed a light sensor, which fully works (completely tested with a multimeter; the 0v/5v logic works perfectly), but not with the USBStepper Card. After starting IOStepper.exe, the Stepper just continued to turn like it did previously.
Also, after a few tries, the card suddenly became urecognised. Interestingly, I tested the pins on the card with a mutlimeter. The multimeter showed "overload" before completely blowing. The USBStepper Card also blew the front 2 ports on my PC!
The power supply is just a normal 5V PSU, like on all my other OC Cards.
fordgt40
09-28-2011, 04:05 AM
Jack
Very sorry to hear that! Lets hope that your computer is not overly damaged.
Regards
David
Boeing 747 Flyer
09-28-2011, 01:09 PM
Luckily, protective circuitry in my PC automatically disables the front 2 ports incase of a surge. I had to re-activate them by unplugging the USBStepper Card, and restarting the PC.
Will use a very tought multimeter tonight to test why I got the Overload readings and why it blew my PC.
fordgt40
09-28-2011, 01:18 PM
Jack
Good news. I assume the current draw from one stepper is less than 1 amp?
Regards
David
Boeing 747 Flyer
09-28-2011, 03:43 PM
Jack
Good news. I assume the current draw from one stepper is less than 1 amp?
Regards
David
Hi David, yes it is.
Unfortunately, still no luck at all.
The light sensor is set up exactly as per the manual, and it's the exact same model number too, so I doubt it's that.
The Stepper just keeps turning and turning. Also, for some reason I have to have SIOC running at the same time as USBStepper.exe (Stepper.exe shou;d just calibrate the motor by turning it once apparently). The SIOC script must just "define" the motor, not make it do anything.
Jack
fordgt40
09-28-2011, 05:20 PM
Jack
The documentation is, as ever, sparse and incomplete. I do not follow why OC ask that you edit the iocstepper.ini file and run the iocstepper.exe to define stepper parameters and set the start point, then have a sioc script that references the stepper motor as Var 0. The stepper motor can have its parameters set by the USBstepper definition within the normal sioc code - so why do we need the iocstepper routine unless it is to define the start point
I would be inclined to try a sioc script that defines the stepper parameters and see what happens. Perhaps IWIK is now awake and can give some advice here?
Regards
David
Hi Guys,
David things may have changed with the new version of Sioc(v4). I know you wre supposed to not have to run IOstepper.exe but had read some people
were not able to get it to work without running it. Im at work at the moment but cant quite remember if i had to run sioc as well as iostepper
to get it to self calibrate. Yo should be able to leave the sensor disconnected and while the motor is spinning put a connection between the two
sensor connections on the card and the motor should stop. So this eliminates the sensor as troublesome. Ive done this many times.
Jack if you are still having troubles. Tonight i will document eaxactly what i do with my stepper to get it to calibrate. It must calibrate when you
first power up. So it knows where start from each time. I know for sure that once first powered up and you short out the two terminals for the sensor
and the motor is spinning it will stop.
Catch you later
Les
Hi Guys,
David, ive looked at the the new version of sioc and see that you can add all the necessary parameters that one would find in the iostepper.ini file.
Havnt had a chance to try that but you do have to run an sioc script along with iostepper.exe if you dont have the the options to add them in the Sioc script.
If you use the iostepper and a script then when powering up, the motor should spin and if you short out pin1 and pin 2 on the sensor input connector
twice, the motor should stop after the second short.
If you want Jack i can try out what david suggested with a known good script. See how you go first.
Les
Boeing 747 Flyer
09-30-2011, 02:49 PM
Hiya Les/David,
Sort've good news.
Shorting the first two wires did give a reaction on the motor, ie it stopped at that point, and when I "nudged" it past, it returned to that point.
However, I don't see what's wrong with the light sensor. The beam is always ON, except for when the "needle" (a small metal bar attached to the rotor) cuts it. I thought that was what should happen?
For clarity, this is the script I'm using:
Var 0000, Link USB_STEPPER, name Chrono, Output 1, PosL 250, PosC 0, PosR 4, Type T
And IOStepper.ini:
[ fichero de configuracion para IOCStepper ]
[ Configuration file for IOCStepper ]
[ Múltiples USBs ]
[ Non unique USB ]
MUSB=No
[ Número de periférico para el USB ]
[ USB Device number ]
deviceUSB=2048
[ Número de A/D a usar de la placa de Expansión USB ]
[ A/D used by Iocard Master expansion USB ]
USB_AD=0
[ IP del HOST del servidor ]
[ IOCP server host name ]
IOCP_host=localhost
[ Puerto de envio del protocolo IOCP ]
[ IOCP port ]
IOCP_port=8092
[ Tiempo de respuesta máximo de los paquetes IOCP ]
[ IOCP Timeout ]
IOCP_timeout=4000
[ Velocidad de los motores (0=rápido, 61=Lento) ]
[ Motor Speed (0=fast, 61=Slow) ]
Speed_M1=50
Speed_M2=17
Speed_M3=17
[ Pasos totales por vuelta de los motores (0=automático) ]
[Motor Steeps per turn (0=automatic) ]
Steeps_M1=0
Steeps_M2=0
Steeps_M3=0
[ Activación de medios pasos para los motores ]
[ half-steeps for motors ]
HSteeps_M1=no
HSteeps_M2=no
HSteeps_M3=no
[ Máximo número de pasos por décima de segundo ]
[Max. Steeps per Dec/Seg ]
Max_Steeps_M1=3
Max_Steeps_M2=3
Max_Steeps_M3=3
[ Factor decimal a aplicar para variable IOCP ]
[ Decimal Factor for IOCP Variable ]
Decimal_Factor_M1=1
Decimal_Factor_M2=1
Decimal_Factor_M3=1
[ Asignaciones de Variables IOCP ]
[ IOCP Variable ]
[ Motor1 ]
IOCP_Var0=10
[ Motor2 ]
IOCP_Var1=11
[ Motor3 ]
IOCP_Var2=12
[ A/D-1 ]
IOCP_Var3=13
[ A/D-2 ]
IOCP_Var4=14
[ A/D-3 ]
IOCP_Var5=15
[ End of File ]
I'm really more interested to see why the light sensor doesn't work. I'm reluctant to upgrade to v4.0, as my cockpit works perfectly (bar the Stepper) on the current version!
Cheers,
Jack
Jack,
Ive checked my one with out running IOstepper.exe. Just sioc code with a line added similar to yours
but cannot make it run although it does calibrate. Use the same code with IOSTepper.exe running and it works.
I had read others had problems also and havnt come across anyone yet that uses it without Iostepper.exe.
I would suggest you run some code with out adding your line and run IOstepper and see if it works.
Ive got some code and iostepper.ini file here that runs the compass with iostepper.exe running if you want it.
Try making your motor Var0010. I think when first trying to get it going i used 0 and had no luck.
Are you sure your the voltage on the sensor pin goes between 5v and say less than 1v.
If you short out the pin twice and the motor stops(like mine does) then the firmware on the card
is working as it should.
Les
Boeing 747 Flyer
09-30-2011, 03:54 PM
Hi Les,
Please could you give me that script and the exact IOCStepper file you are using?
Cheers,
Jack
Jack,
Ive just come in from my w/shop and tested that the following works fine.
Please note you donot need to run IOstepper now. Do the following.
Go to SIOC directory and find Brujula_USBStepper.ssi. Put this name in your SIOC.ini file and run
Fsim.Then run sioc, your motor should start to run s/c pin 1 2 on the sensor input twice and the motor should stop.
Fly the plane and the stepper should move in relation to the Compass. This is code O/C have supplied and it WORKS fine.
Suggest you get everything working with this code then try and get what you want.
Hope this helps
Les
P.S You may have to alter the First parameter(speed i think)
Boeing 747 Flyer
09-30-2011, 04:18 PM
Hi Les,
Unfortunately, after running that script the card is completely dead. Nothing will happen until I run IOStepper.exe.
Interestingly though, when I do run IOStepper.exe, it just keeps turning and turning.
Jack,
Can you make sure all you want to run is Sioc script for the one suggested and only plug in one USBstepper card.
Presently thats what im testing like. I have a sensor plugged in and when the motor has started i pass a piece of
paper between it to stop it.
Trying to keep your system as basic as possible to ensure nothing else is confusing it.
Les
Jack, make a test script only with the o/c stepper output line.
Run this only and your motor should start and be stopped by the sensor. If you can get this far then there is
something radically wrong with your setup. Sioc.ini or hardware.
I have just confirmed the on line will start the motor.
Boeing 747 Flyer
09-30-2011, 04:57 PM
Les, you mean that just the single line declaring the Stepper will get it moving?
Mine certainly doesn't that, and all I'm running is just the one USBStepper Card on my PC.
Jack
All i have in my .ssi file is the line starting V0000 ----
As soon as i start sioc the motor spins and i stop it with the sensor. whats in you sioc.ini file for stepper. My one says 0,0.
Im running on xp for these tests. If you want ill send you my sioc.ini and Sioc script as it works for me.
Les
Boeing 747 Flyer
09-30-2011, 06:03 PM
GREAT NEWS!
I have now managed to get it to stop, every time, on the light sensor...
The reason it took so long was a mistake of opencockpits...
There are 3 slots on the card, "motor 1", "motor 2" and "motor 3". The light sensors for these are labelled appropriately as "M1", "M2" and "M3". For some weird reason, "M3" is actually the sensor for "Motor 1", when it should be motor 3.
So yes, I can confirm it stops at the light sensor. Now I just need to get a chronograph working with it!
Cheers,
Jack
Good News Jack,
My ones are numbered correctly. The only confusion i can see may occur is that on my bd the top connectors are m1 m2 m3 right to left.
Sensors on the left of the bd go s1 s 2 s3 bottom to top.
Main thing is card is working, good luck with your code.
les
Boeing 747 Flyer
10-05-2011, 01:36 PM
Hi all,
Sorry for the lack of replies.
It seems like I'm back to square one on this!
Testing my Stepper motor... Then suddenly, it just vibrates erratically. So I re-ran the basic, basic script that literally just moves the motor. Still the same thing.
Then I tried another Stepper motor. And another. Still the exact, exact same symptoms on each card. The connections are 100% correct, and even then I've tried swapping them around to no avail. The script can't be wrong, it's just the basic script I used awhile back, here it is again just incase:
Var 0000, Link USB_STEPPER, name Chrono, Output 1, PosL 255, PosC 0, PosR 4, Type T
And the IOStepper.ini file:
[ fichero de configuracion para IOCStepper ]
[ Configuration file for IOCStepper ]
[ Múltiples USBs ]
[ Non unique USB ]
MUSB=No
[ Número de periférico para el USB ]
[ USB Device number ]
deviceUSB=2132
[ Número de A/D a usar de la placa de Expansión USB ]
[ A/D used by Iocard Master expansion USB ]
USB_AD=0
[ IP del HOST del servidor ]
[ IOCP server host name ]
IOCP_host=localhost
[ Puerto de envio del protocolo IOCP ]
[ IOCP port ]
IOCP_port=8092
[ Tiempo de respuesta máximo de los paquetes IOCP ]
[ IOCP Timeout ]
IOCP_timeout=4000
[ Velocidad de los motores (0=rápido, 61=Lento) ]
[ Motor Speed (0=fast, 61=Slow) ]
Speed_M1=61
Speed_M2=17
Speed_M3=17
[ Pasos totales por vuelta de los motores (0=automático) ]
[Motor Steeps per turn (0=automatic) ]
Steeps_M1=0
Steeps_M2=0
Steeps_M3=0
[ Activación de medios pasos para los motores ]
[ half-steeps for motors ]
HSteeps_M1=no
HSteeps_M2=no
HSteeps_M3=no
[ Máximo número de pasos por décima de segundo ]
[Max. Steeps per Dec/Seg ]
Max_Steeps_M1=3
Max_Steeps_M2=3
Max_Steeps_M3=3
[ Factor decimal a aplicar para variable IOCP ]
[ Decimal Factor for IOCP Variable ]
Decimal_Factor_M1=1
Decimal_Factor_M2=1
Decimal_Factor_M3=1
[ Asignaciones de Variables IOCP ]
[ IOCP Variable ]
[ Motor1 ]
IOCP_Var0=0
[ Motor2 ]
IOCP_Var1=11
[ Motor3 ]
IOCP_Var2=12
[ A/D-1 ]
IOCP_Var3=13
[ A/D-2 ]
IOCP_Var4=14
[ A/D-3 ]
IOCP_Var5=15
[ End of File ]
So yes, in a bit of a pickle here!
Cheers,
Jack
Jack,
Try changing Posl to say something around 17. This is your speed. All motors i try seem to use approx this Value. Type you have as T. They only show options for this as H for halfstep.
Les
P.S i see in your IOstepper.ini speed is 61 and in SIOC its 255. Sggest you make them same although i dont think
its using the .ini file as its getting its parameters from Sioc
Boeing 747 Flyer
10-05-2011, 05:46 PM
Still no luck Les. I get the exact same symptoms, albeit the motor "vibrates" at a much higher frequency.
I'm really, really confused here. I haven't changed anything and yet am getting this vibration issue.
Jack,
Im not sure that using sioc only for stepper control is that wonderful. Although i havnt had enough time to test properly. I tested out the attached files in FS9 and it works well. Try them and see how you go. I tried using only Sioc again today without changing anything and it was not reliable. Using iostepper seems to be the best.
Les
Boeing 747 Flyer
10-06-2011, 01:06 PM
Hi Les,
I am using IOStepper AND SIOC to control the Stepper Motors.
I will try your file.
Cheers,
Jack
Ok Jack,
let us know how it goes. At least on my set up these files work well. Just put the plane in a 360 degree turn and Stepper turned fully with no hiccups.
Les
Boeing 747 Flyer
10-06-2011, 02:46 PM
Hi Les,
I doubt I'd be able to do that. The motor just sits there vibrating; never mind getting it interfaced to a compass!
Still no luck. I shall try output 2, perhaps output 1 is blown.
Cheers,
Jack
Boeing 747 Flyer
10-06-2011, 04:47 PM
Alright. I connected it to motor output 2 and everything seems ok. Output 1 must be faulty.
I do, however, have another issue. When running the chronograph script, the motor will "skip" at random times, ie will move back a few steps then continue forward.
When testing using IOStepper.exe however, the motor moves freely without any jerks.
Cheers,
Jack
Jack,
I thought you said you were using iostepper along side Sioc. If you are trying to use ONLY sioc i was not happy with what i tried. However skipping maybe due to incorrect speed. Try altering this. Also try the compass code i gave you. In case there is somenthing screwy with yours. It works perfectly on my motor.
Les
Boeing 747 Flyer
10-07-2011, 08:43 PM
Hi Les,
I AM using BOTH SIOC and IOStepper.exe, not JUST SIOC.
Good idea about the speed, perhaps I shall alter it. Can the speed value be "too slow", or is only only too high-a-value that causes skipping?
I will try your Compass script to see if I still get the issue.
Cheers,
Jack
I think you have to find the sweet spot. Differs depending on your motor.
Les
Boeing 747 Flyer
10-09-2011, 07:07 AM
Hi Les,
I am now using a Unipolar motor and it works absolutely perfectly. Very, very smooth.
Further good news: I have implemented the Chronograph script and it also works absolutely perfectly.
This is the script:
Var 0112, name Switch7, Link IOCARD_SW, Input 222 // EVAC Toggle Switch
{
IF &Switch7 = 1
{
&BlinkLed = 60 // begin value of timer
&BlinkLed = TIMER 0 -1 100
}
}
Var 0000, Link USB_STEPPER, name Chrono, Output 3, PosL 240, PosC 0, PosR 4, Type T
Var 6, name BlinkLed
{
L0 = &BlinkLed
L1 = 60 - L0
&Final_Value = L1
}
Var 7, name Final_Value
{
L0 = &Final_Value * 6.00
&Chrono = L0
}
It literally just converts the seconds value into degrees for the Stepper motor to use.
For now, there aren't any more problems.
Thanks so very much for your help Les, and also to David!
Cheers,
Jack