Kommentar: Einfügen von HTML im Kommentar: Link einfügen: <a href="LINKURL" target="_blank">LINKTITEL</a> Bild einfügen: <img src="BILDURL"> Text formatieren: <b>fetter Text</b> <i>kursiver Text</i> <u>unterstrichener Text</u> Kombinationen sind auch möglich z.B.: <b><i>fetter & kursiver Text</i></b> C Quellcode formatieren: <code>Quellcode</code> BASIC Quellcode formatieren: <basic>Quellcode</basic> (Innerhalb eines Quellcodeabschnitts ist kein html möglich.) Wichtig: Bitte mache Zeilenumbrüche, bevor Du am rechten Rand des Eingabefeldes ankommst ! -> I > > > Hi, > > > > > > I am trying to get information from my GPS receiver but the progrm gives this fault: > > > C:\Users\Laurens\Desktop\C-control\Dingen\GPS 1.0\GPS 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 > > > > > > <basic> > > > 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 > > > </basic> > > > > > > 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 > > > > Thanks for your reply. > I've been looking for a split that works but couldn't find one so I tried to do it another way: > > Sub LATTITUDE() > > Dim LAT As Integer > Str_WriteInt(0000000,strGLL,0) > Str_WriteInt(0000000000000000000000000000000,strGLL,17) > LAT = Str_ReadNum(strGLL,4) > > End Sub > > I didn't try it out though. > > Regard, > Laurens