arturvianna
05-02-2015, 07:25 PM
Hi,
Can anyone help me?
I did a series of programming lines to control my fsbus card six pack, but i can't see anything happen in my display, still blank.
My codes are:
(sorry about my english!!)
-->mcpboard.cpp
#include "stdafx.h"
void BuildMcpboardObjects()
{
MkFsbusObject(BTP_DISPLAY, DSP_CRS_L, "",eventhandler,1,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_IAS_MACH, "",eventhandler,2,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_HEADING, "",eventhandler,3,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_ALTITUDE, "",eventhandler,4,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_VERT_SPEED, "",eventhandler,5,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_CRS_R, "",eventhandler,6,0,0);
DisplayOptions(DSP_CRS_L, 3, 0, true, 0);
DisplayOptions(DSP_IAS_MACH, 4, 0, true, 0);
DisplayOptions(DSP_HEADING, 3, 0, true, 0);
DisplayOptions(DSP_ALTITUDE, 5, 0, true, 0);
DisplayOptions(DSP_VERT_SPEED, 5, 0, true, 0);
DisplayOptions(DSP_CRS_R, 3, 0, true, 0);
MkFsObject(FS_AP_COURSE_L, "",eventhandler,0x0C4E,2,TP_UI16,FS_NORMAL,0);
MkFsObject(FS_AP_IAS, "",eventhandler,0x07E2,2,TP_UI16,FS_NORMAL,0);
MkFsObject(FS_AP_MACH, "",eventhandler,0x07E8,2,TP_UI32,FS_NORMAL,0);
MkFsObject(FS_AP_HDG, "",eventhandler,0x07CC,2,TP_UI16,FS_NORMAL,0);
MkFsObject(FS_AP_ALT, "",eventhandler,0x07D4,2,TP_I32,FS_NORMAL,0);
MkFsObject(FS_AP_VS, "",eventhandler,0x07F2,2,TP_I16,FS_NORMAL,0);
}
void eventhandler (int oid, int val, double dval)
{
switch (oid)
{
case (FS_AP_HDG):
FsbusWrite(DSP_HEADING, val);
break;
}
}
-->mcpboard.h
#ifndef __MCPBOARD_H
#define __MCPBOARD_H
void BuildMcpboardObjects();
void eventhandler(int oid, int val, double dval);
enum e_mcpboard{
DSP_CRS_L=OID_MCPBOARD_GROUP,
DSP_IAS_MACH,
DSP_HEADING,
DSP_ALTITUDE,
DSP_VERT_SPEED,
DSP_CRS_R,
FS_AP_COURSE_L,
FS_AP_IAS,
FS_AP_MACH,
FS_AP_HDG,
FS_AP_ALT,
FS_AP_VS,
FS_AP_COURSE_R,
};
#endif
-->stdafx.h
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
#include <windows.h>
#include "fsbus.h"
#define OID_MCPBOARD_GROUP (1<<OID_CONTROL_BITS)
#include "mcpboard.h"
-->mycockpit.cpp
// MyCockpit.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
int _tmain(int argc, _TCHAR* argv[])
{
CheckIn();
FsConnect();
FsbusOpen("COM1");
//TODO: add functions to create the fsbus software objects
BuildMcpboardObjects();
printf("\npress any key to exit...\r\n");
while (!_kbhit())
FsbusMux(500);
CheckOut();
return 0;
}
Using the codes above, the display doesn't shine, but the code works fine on the windows console.
Any idea???
Thanks
Can anyone help me?
I did a series of programming lines to control my fsbus card six pack, but i can't see anything happen in my display, still blank.
My codes are:
(sorry about my english!!)
-->mcpboard.cpp
#include "stdafx.h"
void BuildMcpboardObjects()
{
MkFsbusObject(BTP_DISPLAY, DSP_CRS_L, "",eventhandler,1,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_IAS_MACH, "",eventhandler,2,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_HEADING, "",eventhandler,3,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_ALTITUDE, "",eventhandler,4,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_VERT_SPEED, "",eventhandler,5,0,0);
MkFsbusObject(BTP_DISPLAY, DSP_CRS_R, "",eventhandler,6,0,0);
DisplayOptions(DSP_CRS_L, 3, 0, true, 0);
DisplayOptions(DSP_IAS_MACH, 4, 0, true, 0);
DisplayOptions(DSP_HEADING, 3, 0, true, 0);
DisplayOptions(DSP_ALTITUDE, 5, 0, true, 0);
DisplayOptions(DSP_VERT_SPEED, 5, 0, true, 0);
DisplayOptions(DSP_CRS_R, 3, 0, true, 0);
MkFsObject(FS_AP_COURSE_L, "",eventhandler,0x0C4E,2,TP_UI16,FS_NORMAL,0);
MkFsObject(FS_AP_IAS, "",eventhandler,0x07E2,2,TP_UI16,FS_NORMAL,0);
MkFsObject(FS_AP_MACH, "",eventhandler,0x07E8,2,TP_UI32,FS_NORMAL,0);
MkFsObject(FS_AP_HDG, "",eventhandler,0x07CC,2,TP_UI16,FS_NORMAL,0);
MkFsObject(FS_AP_ALT, "",eventhandler,0x07D4,2,TP_I32,FS_NORMAL,0);
MkFsObject(FS_AP_VS, "",eventhandler,0x07F2,2,TP_I16,FS_NORMAL,0);
}
void eventhandler (int oid, int val, double dval)
{
switch (oid)
{
case (FS_AP_HDG):
FsbusWrite(DSP_HEADING, val);
break;
}
}
-->mcpboard.h
#ifndef __MCPBOARD_H
#define __MCPBOARD_H
void BuildMcpboardObjects();
void eventhandler(int oid, int val, double dval);
enum e_mcpboard{
DSP_CRS_L=OID_MCPBOARD_GROUP,
DSP_IAS_MACH,
DSP_HEADING,
DSP_ALTITUDE,
DSP_VERT_SPEED,
DSP_CRS_R,
FS_AP_COURSE_L,
FS_AP_IAS,
FS_AP_MACH,
FS_AP_HDG,
FS_AP_ALT,
FS_AP_VS,
FS_AP_COURSE_R,
};
#endif
-->stdafx.h
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
#include <windows.h>
#include "fsbus.h"
#define OID_MCPBOARD_GROUP (1<<OID_CONTROL_BITS)
#include "mcpboard.h"
-->mycockpit.cpp
// MyCockpit.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
int _tmain(int argc, _TCHAR* argv[])
{
CheckIn();
FsConnect();
FsbusOpen("COM1");
//TODO: add functions to create the fsbus software objects
BuildMcpboardObjects();
printf("\npress any key to exit...\r\n");
while (!_kbhit())
FsbusMux(500);
CheckOut();
return 0;
}
Using the codes above, the display doesn't shine, but the code works fine on the windows console.
Any idea???
Thanks