background image

14

last set of data received.  It is important that you wait
long enough for the data to arrive and this will be
determined by the baud rate and the number of
channels that you are sampling.  It may well be that the
processing takes longer than the time required to wait,
but if you don’t have much processing to do, then you
will have to include some sort of timed wait in order to
avoid looking for data that hasn’t arrived.

4.2  T

UTORIAL

FLYBOX

_

TEST

.

C

Perhaps the easiest way to understand how to use the
software is to study an example.  In the 

bg/FlyBox

directory, the source code in

 flybox_test.c 

is a fairly

simple program that samples the FlyBox and prints the
values to the terminal.

There is a

 Makefile

 in the directory, and you should be

able to type:

% make flybox

to compile and link the executable

 flybox.

4.2.1  Setup

As you go through this example, look at the file

flybox_test.c 

and make sure that it matches this

document.

The low level library routines use a data structure,
defined as 

bglv

, that is defined in 

lv3.h

.  (Note that this

file is in the 

bg

 directory.)  This data structure must be

declared in the main file.

#include “lv3.h”

bglv bgdata;

// Main BG data structure

$

Note the use of C++ style comments //

which are not in the actual code, but are
used here to help readability.

Only the following members need to be set.

int    analog_in;

//  Analog input selector

int    dig_in;

//  Digital input selector

int    baud;

//  Baud rate selected

$

The remaining members of the structure

are computed in open_lv() and init_lv().

The 

bglv

 structure is passed to most of the library

functions in the call sequence.  In order to collect data
from the FlyBox, the serial port needs to be opened by

Содержание FlyBox

Страница 1: ...FLYBOX HARDWARE MANUAL...

Страница 2: ......

Страница 3: ...G ADDITIONAL INPUTS 9 CHAPTER 3 HARDWARE 11 3 1 THE JOYSTICK 11 3 2 LEVERS 12 3 3 SWITCHES 12 CHAPTER 4 SOFTWARE 13 4 1 SOME BASICS 13 4 1 1 Connecting the FlyBox 13 4 1 2 Theory of Operation 13 4 2 T...

Страница 4: ...4 CHAPTER 5 TROUBLESHOOTING 19 5 1 THE FLYBOX IS NOT RESPONDING 19 5 1 1 Serial Cable 19 5 1 2 No Power 20 5 1 3 Joystick Problems 20 5 1 4 Interference 20 CHAPTER 6 TECHNICAL SPECIFICATIONS 21...

Страница 5: ...mmunicate with the FlyBox and some troubleshoot ing hints This manual should be read in conjunction with the LV824 Software Manual which contains specific details about the software that is used on th...

Страница 6: ...e font is used whenever a code fragment is presented tios c_flag CS8 CREAD CLOCAL A monospace font preceded by a is used for Unix shell commands cd FlyBox When the font is preceded by a it means that...

Страница 7: ...is located on the right hand side as you look at the back of the case The FlyBox is set for 110v when shipped within the U S A International shipments are usually set to 220v Before connecting the po...

Страница 8: ...own in figure 4 Just push out the two rectangular boxes underneath the fuses F The power cord that comes with the FlyBox has a THREE pin connector DO NOT CUT OFF THE THIRD PIN This provides ground for...

Страница 9: ...uses 5 analog and 9 discrete inputs Consequently we have provided 4 extra DB 9 ports on the back of the FlyBox see figure 5 Additional discrete inputs can be connected to the port labelled Discrete In...

Страница 10: ...10...

Страница 11: ...and Twist yaw There is a trigger on the joystick which is a digital input The three axes of the joystick provide a proportional output between 0 5 volts which is converted to a 12 bit analog signal s...

Страница 12: ...the LV824 circuit board and the software values run from 1 0 to 1 0 3 3 SWITCHES There are 6 discrete switches red covers mounted on the FlyBox nearest the top These switches produce a discrete on of...

Страница 13: ...you are ready to test the connection to see if you can communi cate with the FlyBox However there are some parameters that you need to be aware of on the host in order to get started Note that this i...

Страница 14: ...d you should be able to type make flybox to compile and link the executable flybox 4 2 1 Setup As you go through this example look at the file flybox_test c and make sure that it matches this document...

Страница 15: ...tep is to open the serial device on the host with the open_lv function The call takes three arguments the first is the address of the BG data structure the second specifies the dev tty that you are co...

Страница 16: ...suming communication at 19200 baud If you want to operate at a different baud rate you can set this when you init_lv with bgdata baud set to BAUD9600 for example However be aware that if you don t clo...

Страница 17: ...tches Of course there are some combina tions that are not available and also some of the mappings occur more than once Table 3 Optional Digital Inputs bgdata Function Or with Shift Note din 1 4 pos le...

Страница 18: ...18...

Страница 19: ...Systems 3 Does the yellow LED blink when you turn on power If not then the FlyBox is not working Call BG Systems for help 4 If the yellow LED blinks when you apply power it should also blink when you...

Страница 20: ...the LV824 drops below 5 and it stops functioning This gives the appearance of a FlyBox that is acting flakey Please double check the voltage selector 5 1 3 Joystick Problems The new JFx joysticks are...

Страница 21: ...tes Supported 2400 4800 9600 19200 38400 57600 115200 Power Supply Switchable between 110vAC and 220vAC at 50 60 Hz 750 mAmp capability Power Draw LV824 E 240 mAmp Serial Interface RS 232 Rx Tx Gnd Ha...

Страница 22: ...22...

Страница 23: ...Copyright 1998 BG Systems Inc All Rights Reserved FlyBox Hardware Manual 4 01 February 1998 FlyBox is a registered trademark of BG Systems Inc...

Страница 24: ...BG Systems Inc Palo Alto California USA Tel 650 858 2628 Fax 650 858 2685 URL www bgsystems com...

Отзывы: