/*
GPS.c: GPS Demo for G-4500

Compiler: BC++ 3.1
          Turbo C ++ 1.01(3.01) 

Compile mode: large

Project: GPS.c
         G4500.lib

Hardware: G-4500P

[02/Apr/2009] Modify by Yide
[19/Mar/2009] Modify by Yide
[01/Dec/2008] Create by Yide
*/
//#define _MINIOS7_STUDIO_

#ifdef _MINIOS7_STUDIO_
#include <icpdas.h>
#else

#include <stdio.h>
#include <string.h>
#include <conio.h>
#include "G4500.h"
#endif

int GPS_Port = 5;
void main(void)
{
    int iRev; //Read Hardware Revision
    unsigned char cTemp[200];
    InitLib();
    InstallCom(GPS_Port, 9600L, 8, 0 ,1);  // Initial GPS Port
    
    GetLibDate(cTemp);                
    iRev=GetLibVersion();
    Print("G4500.Lib vesion %X.%02X, Date:%s\r\n", iRev>>8, iRev&0xff, cTemp);
    
    X305IO_Init();
    iRev = X305IO_Set_GPS(1);
/*
int X305IO_Set_GPS(int mode);
mode:
0 : Disable GPS chip
1 : Enable GPS chip

*/    
    Puts("\r\n");
    Puts("************************************\n\r");
    Puts("|                                  |\n\r");
    Puts("|      GPS Demo for G-4500P        |\n\r");
    Puts("|                                  |\n\r");
    Puts("************************************\n\r");

        // ===== COM5 GPS =====              
    for(;;)
    {
        if(IsCom(GPS_Port))
            Print("%c", ReadCom(GPS_Port));
                
        if(Kbhit())
            if(Getch()=='q')
                break;
    }   
}
