Re: Indices Kategorie: Programmierung Basic (von PeterS - 28.01.2013 19:23) | |
Als Antwort auf Indices von Laurens - 28.01.2013 17:38
| |
> Hi, > > I am trying to get information from my GPS receiver but the progrm gives this fault: > C:UsersLaurensDesktopC-controlDingenGPS 1.0GPS 1.0.cbas(16,5): Semantic Error > - array variable strGLL must have1 indices > What does this mean? And how can I resolve it? > > I have another question, how do I get the lattitude and longtitude out of the GLL since it looks like this: > $GPGLL,3723.2475,N,12158.3416,W,161229.487,A*2C > > > Dim strGLL(47) As Char 'Example $GPGLL,3723.2475,N,12158.3416,W,161229.487,A*2C > > Sub Main() > > Serial_Init(0,SR_8BIT Or SR_1STOP Or SR_NO_PAR,SR_BD4800) > GETGPS() > > End Sub > > Sub GETGPS() > > Dim strINPUT(28) As Char > strINPUT = "$PSRF103,01,01,00,01*24,0D0A" > Serial_WriteText(0,strINPUT) > AbsDelay(2000) > strGLL = Serial_Read(0) > > End Sub > > Sub LATTITUDE() > > Dim strLAT(9) As Char > strLAT = Split(strGLL, ".") > > End Sub > > > With kind regards > Laurens There are 3 problems: 1.) strINPUT is too small, since the string must be terminated with a null char 2.) You have not defined a function Split() 3.) strGLL is an array variable. Since Serial_Read(0) gives back one character, you must write strGLL(i) = Serial_Read(0) It looks like that you should consult the demo programs first, to get some impression how to work with the BASIC. Regards, Peter | |
Antwort schreiben Antworten: Re: Indices (von Laurens - 29.01.2013 19:13) |
Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - Zum C-Control-I-Forum - Zum C-Control-II-Forum