⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globals.c

📁 GPS导航定位程序
💻 C
字号:
/****************************************************************************
* This include file contains initialisation of global variables used
* throughout the GPS Builder-2 software.
****************************************************************************/

#include "includes.h"

long Ta;                             /* Correlation acquisition threshold. */ 
long Tl;                                    /* Correlation loss threshold. */
int CdLIav;                 /* log2 of code lock indicator averaging time. */
int CrLIav;              /* log2 of carrier lock indicator averaging time. */
long CrLIrf;                /* Rounding factor for carrier lock indicator. */
unsigned Coast;           /* # ms to coast before re-entering search mode. */
long CodeSrchIncr;            /* Code DCO incr to move code during search. */
double InitOscAcc;         /* Initial (maximum) 10 MHz ref osc error, ppm. */
double OscAcc;                /* Current 10 MHz ref osc RMS accuracy, ppm. */
double OscFreqChgRate;             /* Max osc freq change, ppm per second. */
long CodeDoppBinWidth;                 /* Code DCO offset per Doppler bin. */
long CarrDoppBinWidth;              /* Carrier DCO offset per Doppler bin. */
unsigned NDoppBin;               /* How many Doppler bins in search range. */
double DoppBinWidth;                             /* Doppler bin width, Hz. */
long CodeDoppFromClk;                       /* Clock error, code DCO units.*/
long CarrDoppFromClk;                    /* Clock error, carrier DCO units.*/

navstatestruc CurNavState;                    /* Current navigation state. */ 
clockmodelstruc CurClkModel;                 /* Current clock model state. */ 

float reflat;                /* User's WGS-84 reference latitude, radians. */
float reflon;               /* User's WGS-84 reference longitude, radians. */
float refhgt;              /* User's WGS-84 ref. ellipsoid height, meters. */

almstruc alms[MAXSATELLITES];              /* Almanacs for all satellites. */
ephstruc ephs[MAXSATELLITES];           /* Ephemerides for all satellites. */
iustruc ionoutc;                    /* Ionospheric model & UTC parameters. */

logical Deselect[MAXSATELLITES];                   /* User deselected SVs. */
int ActiveChannels = 6;                      /* Number of active channels. */
int ActiveChannelMask = 0x003F;            /* Bit mask of active channels. */
int svsel[MAXCHANNELS];                         /* Currently selected SVs. */

chanstruc CH[MAXCHANNELS];                      /* Channel control blocks. */

unsigned MaxAccumPending;           /* High-water mark for accums pending. */
unsigned missa;                              /* Missed accumulation count. */      

sfstruc sfbuff[MAXCHANNELS];                           /* Subframe buffer. */
unsigned SfPending;                  /* # subframes pending in the buffer. */
unsigned MaxSfPending;                   /* High-water mark for SfPending. */
int csf;                             /* Index of next subframe to collect. */
int psf;                             /* Index of next subframe to process. */
unsigned misssf;                                 /* Missed subframe count. */
int lastsf[MAXSATELLITES];              /* Last subframe received from SV. */
unsigned long TimeOfLastSubframe[MAXSATELLITES+1];  /* Time SF was logged. */

obsstruc far *obsbuff;                  /* Pointer to observations buffer. */
unsigned ObsPending;              /* # observations pending in the buffer. */
unsigned MaxObsPending;                 /* High-water mark for ObsPending. */
int cobs;                         /* Index of next observation to collect. */
int pobs;                         /* Index of next observation to process. */
unsigned misso;                               /* Missed observation count. */
unsigned lastmisso;             /* Last value of missed observation count. */
logical ObservationReady = FALSE;      /* Logical for observation present. */
logical LostObservations = FALSE;       /* Logical for observation missed. */

unsigned missm;                               /* Missed measurement count. */

int BeacPort;             /* Beacon port, 0=Inactive, 1=COM1, 2=COM2, etc. */
double BeacFreq;                                  /* Beacon frequency, Hz. */
int BeacBaud;                  /* Beacon baud rate (0,25,50,100,200), bps. */
beacstruc BEAC;              /* Current DGPS beacon information structure. */

FILE *CmdFile[MaxCmdFileNesting];                   /* Open command files. */
int cmdmode = DISPLAY;                         /* DISPLAY or COMMAND mode. */
char cb[90];                                            /* Command buffer. */
int cbindex;                                      /* Command buffer index. */
int cbready;                 /* 1=Command string has been assembled in cb. */
int CmdFileNesting;          /* Command file nesting level, 0=none active. */

FILE *fpDataLog = NULL;                          /* Data log file pointer. */
char DataLogFile[13];                                /* Data log filename. */
char DataLogComment[64] = "GPSBLDR-2";   /* Text at end of logged records. */
logical DataLogSerial = FALSE;   /* Logical for data log through COM port. */
time_t time_of_last_log = 0;                /* Time of last logged record. */
long DataLogInterval = 0L;          /* Interval between logged records, s. */
long TimeToNextLog = 0L;                 /* Time to next logged record, s. */
long DataRecordsLogged = 0L;                      /* Total records logged. */
int ReceiverID = 1;                    /* Receiver ID used in data record. */
                      
FILE *Rx2N = NULL;                              /* Rinex2 Navigation file. */
FILE *Rx2O = NULL;                             /* Rinex2 Observation file. */
unsigned long Rx2TIC;               /* TIC of next Rinex2 obs, 0=inactive. */
int Rx2Interval;                     /* Data collection interval, seconds. */
unsigned long Rx2NRecs;                      /* # Navigation file records. */
unsigned long Rx2ORecs;                     /* # Observation file records. */
double Rx2Obsv[36];                                   /* Observation data. */
int Rx2Lli[36];                                   /* Lost lock indicators. */
int Rx2Sigstr[36];                                     /* Signal strenghs. */

FILE *CfgFile;                             /* Configuration strat-up file. */

logical DontMove = FALSE;                  /* Logical for static receiver. */

float ElvMask;                                 /* Elevation mask, degrees. */

float GdopMask;                                              /* GDOP mask. */

int DisplayFunc;                       /* Function key for current screen. */
logical RedrawFixedPortionsOfDisplay = TRUE;              /* Do a re-draw. */
logical EraseDisplay = TRUE;                               /* Do an erase. */

int HelpPage;                                 /* Current help page number. */
int AlmPage;                               /* Current almanac page number. */
int EphPage;                             /* Current ephemeris page number. */

int LastAlm;                                   /* SV # for latest almanac. */

unsigned long GPIntCtr;                    /* The current interrupt count. */
unsigned long TIC;                               /* The current TIC count. */
unsigned EXECUTIC;                    /* TIC count for task re-activation. */

int TrackMode;                                  /* The current track mode. */

int ielvd[MAXSATELLITES];                           /* SV elevation, degs. */
int iazid[MAXSATELLITES];                             /* SV azimuth, degs. */
int idopp[MAXSATELLITES];                               /* SV Doppler, Hz. */

float sverc[MAXSATELLITES];                  /* Earth rotation correction. */
float sviono[MAXSATELLITES];                    /* Ionospheric correction. */
float svtropo[MAXSATELLITES];                  /* Tropospheric correction. */

int TimeZone = 0;                               /* User time zone wrt GMT. */

Integrated_Carrier_Phase ICP;                      /* Struct for ICP data. */

int cursrch=MAXSATELLITES+1;         /* Index for cold start SV selection. */

int TestingInterface;              /* Testing the GPS Builder-2 interface. */

int NumSatsInSoln;                 /* Number of SV in navigation solution. */

logical IntegratedCarrier=TRUE;       /* Logical for using ICP in nav fix. */

logical AltitudeAided=TRUE;        /* Logical for allowing 2-D navigation. */

int GPINT;                       /* GPS Builder(TM) interrupt (IRQ) level. */
int CORRELATOR;                      /* Port address of GP2021 correlator. */
int GPIMASK;                     /* Port address of GP2021 interrupt mask. */
int GPRESET;                      /* Port address of GP2021 reset control. */

void interrupt (*oldisrK)(__CPPARGS);        /* Old ISR for the GPINT IRQ. */
unsigned oldmskA;                            /* Old PIC A interrupt masks. */
unsigned oldmskB;                            /* Old PIC B interrupt masks. */
int gpvec;                              /* GPS Builder-2 interrupt vector. */
int gpmask;                               /* GPS Builder-2 interrupt mask. */

unsigned NextCKPT;                        /* Index of next available CKPT. */ 
CKPTstruc CKPT[NCKPT];                            /* Recorded checkpoints. */

int oldcursorshape;                         /* Old cursor shape parameter. */

int ISRNEST;                                 /* Current ISR nesting level. */
void far *ISTACKS[3];                       /* Far pointers to ISR stacks. */
unsigned IStkSS[3];                       /* SS values for the ISR stacks. */
unsigned IStkSP[3];                       /* SP values for the ISR stacks. */

unsigned MStkSS;           /* main() stack SS at beginning of the program. */
unsigned MStkSP;           /* main() stack SP at beginning of the program. */
unsigned MStkHwm;               /* Lowest value of SP seen when SS=MStkSS. */

jmp_buf cbrkjmp;                         /* Used when exit with CTL-BREAK. */

unsigned PROTECT = 1;                  /* Protects against task switching. */

int FixesInColdStart = 0;           /* Number of fixes in Cold Start mode. */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -