Results 571 to 580 of 737
Thread: Progamming help with FSBus dll
-
01-22-2011, 08:08 AM #571
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
Did you write a small programm to test your steppers wih the stepper board?
Here my programm:
Code:#include "stdafx.h" #include "fsbus.h" int _tmain(int argc, _TCHAR* argv[]) { CheckIn(); BOOL b = FsbusOpen("COM3"); FsbusWriteFmtVar(29, 80, 0); FsbusMux(2000); FsbusWriteFmtVar(29, 80, 2000); FsbusMux(2000); FsbusWriteFmtVar(29, 80, 0); FsbusMux(2000); CheckOut(); return 0; }
-
01-22-2011, 08:17 AM #572
Re: Progamming help with FSBus dll
I tested the stepper boards when Dirk sent through some sample code some time ago (He used v1 of the dll to test it though, I think you pointed that out).
So, I know the boards work.
This was what I used (pretty well just minor changes to your code)
Code:#include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { CheckIn(); BOOL b = FsbusOpen("COM1"); FsbusWriteFmtVar(29, 80, 0); FsbusMux(2000); FsbusWriteFmtVar(29, 80, 100); FsbusMux(2000); FsbusWriteFmtVar(29, 80, 0); FsbusMux(2000); CheckOut(); return 0; }
I am getting 1 compiling error though: steppergauges.cpp(22) : error C2447: '{' : missing function header (old-style formal list?)
This is the code exactly to this minute that is producing the error:
Code:#include "stdafx.h" #include "fsbus.h" void cbSteppergauges(int oid, int val, double dval); #define FS_ADF1RELATIVEBEARING 1 #define FS_ADF1DIALBEARING 2 //#define C_ADFCOMPASSCARD 3 //#define C_ADFBEARINGNEEDLE 4 #define C_RADFROSEADJUST 5 static int ADFroseadjust = 0; void cbSteppergaugesBuildObjects() { MkFsObject(FS_ADF1RELATIVEBEARING,"ADF Needle", cbSteppergauges, 0x0C6A, 2, TP_I16, FS_NORMAL,0); MkFsObject(FS_ADF1DIALBEARING,"ADF Compass Card", cbSteppergauges, 0x0C6C, 2, TP_I16, FS_NORMAL,0); //MkFsbusObject(BTP_V_OUT, C_ADFCOMPASSCARD,"",NULL,30,80,0); //MkFsbusObject(BTP_V_OUT, C_ADFBEARINGNEEDLE,"",NULL,29,80,0); MkFsbusObject(BTP_ROTARY, C_RADFROSEADJUST, "",cbModecontrolpanel, 27, 26, 0); } void cbSteppergauges(int oid, int val, double dval); { int x; switch(oid) { case FS_ADF1RELATIVEBEARING: FsbusWriteFmtVar(29,80,val); break; case FS_ADF1DIALBEARING: FsbusWriteFmtVar(30,80,val); break; case C_RADFROSEADJUST: ADFroseadjust -= val; while (ADFroseadjust > 360) ADFroseadjust -= 360; while (ADFroseadjust <=0) ADFroseadjust += 360; x = (ADFroseadjust % 360); FsWriteInt(FS_ADF1DIALBEARING,x); break; } }
David
-
01-22-2011, 08:19 AM #573
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
try that test with the V3 dll. that works in my sample.
Edit: donīt!!!
void cbSteppergauges(int oid, int val, double dval);
has to be
void cbSteppergauges(int oid, int val, double dval)
-
01-22-2011, 08:53 AM #574
Re: Progamming help with FSBus dll
Great, compiles now.
So looking back at some code you worked with me on for my Altitude gauge, I can see how 'val' is worked out.
Code:case FS_ALTIMETERFEET: val=val/5; // 1000feet for 360° are 200 steps (1000/200) //printf("Altimeter Feet %d\n", val); FsbusWriteFmtVar(8, 80,val); break;
Thanks
-
01-22-2011, 09:04 AM #575
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
sounds perfect. if you have a gear dont forget it.
A 200step neadle on a 360° scale donīt perfect.
-
01-22-2011, 09:09 AM #576
Re: Progamming help with FSBus dll
I do have gears so I will work it out.
I am trying to print the value of the ADF needle and the ADF rose face, and I don't seem to be getting anything.
Here's what I have (I have the same for the altitude and it prints it fine):
case FS_ADF1RELATIVEBEARING:
val=val/1; // 360° are ? steps
printf("ADF relative bearing %d\n", val);
FsbusWriteFmtVar(29,80,val);
break;
-
01-22-2011, 09:13 AM #577
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
I am trying to print the value of the ADF needle and the ADF rose face, and I don't seem to be getting anything.
Input value: 12345 Needle Position: 67890
right??
-
01-22-2011, 09:19 AM #578
Re: Progamming help with FSBus dll
Well, it's not really important to have as I can get these figures from FSInterrogate. I was just wondering why it isn't printing any value at all when I move the needle or the dial face.
Also, the ADF Dial heading works on a simple 0 - 360, but the Needle works on -179.9 to 0 to 179.9 0 being at the top, -179 being to the left and +179 to the right. Will I need to write the needle differently?
-
01-22-2011, 09:28 AM #579
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
Yes, but i woudl try somethink like
case that with the -179 to 179:
val = val + 179;
than you have your 0 in the -179 positon.
but!!
if (val >=0)
{
val = ( val+1);
}
-
01-22-2011, 09:39 AM #580
Re: Progamming help with FSBus dll
Ah ha, then I can use the 360degress divided by how many steps the motor has in 360deg. I would never have thought of that.
Thank you.
So now I have:
case FS_ADF1RELATIVEBEARING:
val = val + 179;
if (val >=0)
{
val = (val+1);
}
printf("ADF relative bearing %d\n", val);
FsbusWriteFmtVar(29,80,val);
break;
Any idea why it's still not showing anything is the DOS box for the print function?
Similar Threads
-
Fsbus CDK
By flyandre in forum General Builder Questions All Aircraft TypesReplies: 4Last Post: 12-27-2014, 12:58 PM -
Need Help Getting My FSBUS NG I/O Going Again..
By JBRoberts in forum I/O Interfacing Hardware and SoftwareReplies: 14Last Post: 03-21-2010, 01:38 PM -
Fsbus ng io
By Davral in forum I/O Interfacing Hardware and SoftwareReplies: 0Last Post: 01-10-2009, 10:38 PM -
Fsbus 2.4.3
By Anderson/SBSP in forum I/O Interfacing Hardware and SoftwareReplies: 9Last Post: 11-30-2008, 04:25 PM -
Help FSBUS
By cesarfsim in forum I/O Interfacing Hardware and SoftwareReplies: 2Last Post: 10-26-2008, 02:23 PM
Search Womans from your town for night
HDG preselect function