i get these errors C:\Program Files\Microsoft Visual Studio\VC98\MGC4C\apps\gprmc.c(125) : warning C4013: '_T' undefined; assuming extern returning int C:\Program Files\Microsoft Visual Studio\VC98\MGC4C\apps\gprmc.c(125) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int ' C:\Program Files\Microsoft Visual Studio\VC98\MGC4C\apps\gprmc.c(125) : warning C4024: 'wsprintfA' : different types for formal and actual parameter 2
knightri
Posts
-
Question on serial port and data buffer -
Question on serial port and data bufferI have a GPS program serially reading incoming data. A sample of my code is below. // get speed Code = mgcGetData(GPRMC_SPEED,(LPSTR)DataBuffer); if(Code<0) ShowMGC32Error(Code); if(Code>0) printf("%5s ", DataBuffer); I have the program printing a few of these data buffers to the screen. I was wondering how to store this data file readout into a actual variable so i can do some calculations i cant just do variable=databuffer; ???
-
Visual C++ and MicrocontrollerOk let me lay it out for everyone so they have a cleaer picture. Free to use This is the c file I am using. //RMC Message Parser // COMPILE: From the command line: // // nmake -f gprmc._m_ #include #include #include #include #include #include #include "mgc.h" #include "keycode.h" char DataBuffer[256]; int Port; double latitude; double longitude; double currentlatitude; double currentlongitude; /* For error detection */ int ShowMGC32Error(int Code) { static char ErrBuffer[128]; mgcErrorText(Code, (char *)ErrBuffer); printf("%s\n", ErrBuffer); return Code; } /*** main ***/ void main(int argc, char *argv[]) { int Code; /* process args */ if(argc!=2) { printf("Usage: GPRMC \n"); return; } Code = mgcAttach(MGC_KEY_CODE); //checks for proper identification if(Code<0) { printf("Error %d: Cannot attach MGC32.DLL, check key code\n", Code); return; } Port = atoi(argv[1]) - 1; //converts string into an integer Code = mgcOpen(Port); //opens com if(Code<0) { ShowMGC32Error(Code); exit(1); } printf("GPRMC Test Program\n"); printf("MGC Version %1d.%1d.%1d\n", mgcGetInteger(MGC_GET_VERSION_DIGIT1), mgcGetInteger(MGC_GET_VERSION_DIGIT2), mgcGetInteger(MGC_GET_VERSION_DIGIT3)); // specify which sentence (RMC) Code = mgcSetInteger(MGC_SET_SENTENCE_TYPE, MGC_SENTENCE_GPRMC); if(Code<0) { ShowMGC32Error(Code); exit(1); } printf("Enter destination latitude: \n"); cin>>latitude; printf("Enter destination longitude:\n"); cin>>longitude; printf("Alex Czeto GPS RMC Message Parser Test Version \n"); printf("Date Time V Speed Course Latitude Longitude \n"); printf("==== ==== = ===== ====== ======== ========= \n"); while(1) {// was any key pressed ? if(kbhit()) break; // lock data buffer mgcLockData(1); // get date Code = mgcGetData(GPRMC_DATE,(LPSTR)DataBuffer); if(Code<0) ShowMGC32Error(Code); if(Code==1) {// reference count = 1 (1st time seen this data) if(Code>0) printf("%5s ", DataBuffer); // get timestamp Code = mgcGetData(GPRMC_UTC_TIME,(LPSTR)DataBuffer); if(Code<0) ShowMGC32Error(Code); if(Code>0) printf("%5s ", DataBuffer); // get validity Code = mgcGetData(GPRMC_VALIDITY,(LPSTR)DataBuffer); if(Code<0) ShowMGC32Error(Code); if(Code>0
-
Visual C++ and MicrocontrollerHi. Currently I have a Visual C+ program that communicates with a GPS device through a serial-to-USB interface. Analysis of the GPS information leads to a set of control signals being sent to a Motorola HC12 Microcontroller. I was wondering if anyone had any ideas on how this process could take place. Basically the micro controls acceleration and steering for an autonomous vehicle I am working on. From the micro, 5 volts control an analog switch varying +/- 12 volts to a steering motor and alos from the micro a bit signal that sets the correct wiper setting in the digital potentiometer. I need a way to send a signal from the Windows XP laptop I am using to the microcontroller through a serial port. I am using the MarshallSoft GPS DLL to manipulate the USB port that the GPS information comes into. Since I have a serial-to-usb conversion acting on COM4, how do I take control of Com1 lets say and send a particular bit pattern to the micro?????Any help would greatly be appreciated.