! 27-11-2016 Bug trouvé ! extirpation de La et Lo sur trame complete !27/11/16 12H32M43S Lon : 5.038765 N Lat : 45.845384 E Alt : 187.4 ..etc ! valeurs par defaut jamais rafraichie ! au lieu de trame reduite !Ublox OK,5.038765,45.845336,193.3,05 !application coté MikroC: !Directory: C:\_MikroC\_MesProjets_MikroC\_18F87J50_GPS ! Projet : Survivor_18F87J50_48Mhz_GPS_UBLOX_7N_seul_LCD2119_24FC1206_BT_1610.mcppi ! Source: Survivor_18F87J50_48MHz_GPS_UBLOX_7N_seul_LCD_EEprom1MB_BT_161127 ! FOSC=48MHZ PLL active ! UART1 RC6 TX 19200 --> prolifix---> Diplay Terminal PC ! UART1 RC7 RX 19200 <-- prolifix <--- clavier Terminal PC ! UART2 RX RG2 19200 <-- GPS UBLOX 7N ! Decodage de 2 Trames NMEA: GPGGA + GPRMC !Numbers in BASIC! are double-precision floating point (64-bit IEEE 754). ! OUPS ! St Eloi au lieu de La Boisse ?? !45.94566 et 6.13875 avec convertion !latitude=val(la$) longitude=val(lo$) ! avec un format$("##%.#####", latitude) au lieu de format$("##%.######", lattitude) ! avec data Ublox correctes !Ublox OK,5.038765,45.845336,193.3,05 !Ublox OK,5.038749,45.845341,195.8,05 !Ublox OK,5.038715,45.845336,197.0,05 ! ligne 261 limite=100 !! sur PC ASUS WIN10 RFO-BASIC! Launcher v0.8 File transfered over LAN at 4840 KB/s (4957 bytes in 0.001 second) >Exit code: 1 >"rfo-basic launcher.exe" "D:\_Archos43\rfo-basic\source\GPS_Ublox_PIC18F_Via_BlueTooth_" ------------------------------------------------------------------------------- RFO-BASIC! Launcher v0.8 File transfered over LAN at 4780 KB/s (4895 bytes in 0.001 second) >Exit code: 1 !! % ******************************************************* dim rec_Array$[10] % ATTENTION , ne pas dimensionner si usage de split Rev$="161127" debug.on A$=" " A1$=" " texte$=" " msgE$= " " ! exemple de Trame recue msgR$="1234567890123456789012345678901234567890" recept$=msgR$ msgR$="" recept$="Waiting GPS data" debug.print recept$ print "init variables" nbb=0 nb=0 k1=0 nb=0 NumTrame=0 KL=0 premier=0 J3=0 K3=0 L3=0 M3=0 Longueur=0 ! text pointer for GPS data ! p1 test=0 % ********************************************** Lo$=" " La$=" " Al$=" " Sa$=" " Prog$="GPSUblox_testPIC18F_Via_BlueTooth_" print "Application RFO-Basic" print Prog$," rev ";Rev$ print "Version basic : "; Version$() Device DV$ print "Device Info : "; DV$ Longitude=0 Latitude=0 La$=" " Lo$=" " BT.OPEN pause 1000 new_connection: xdomenu =0 BT.CONNECT 0 pause 5000 ! Read status until ! a connection is made ln = 0 DO BT.STATUS s IF s = 1 ln = ln + 1 PRINT "Listening", ln ELSEIF s =2 PRINT "Connecting",ln ENDIF PAUSE 1000 UNTIL s = 3 ! When a connection is made ! get the name of the connected ! device BT.DEVICE.NAME device$ print "Connected to ";device$;chr$(13) print "Ready to receive command, touch the screen " print chr$(13) ! *** Read/Write Loop **** gr.open 255,0,0,0,0,0 gr.color 255,0,0,255,0 gr.screen w,h print w print h gr.render pause 500 gr.set.stroke 3 gr.text.size 24 gr.color 255,0,255,0,1 % vert gr.text.draw p1,25,50,recept$ gr.Show p1 gr.render ! init zoom value Z=15 html.close pause 200 html.open pause 1000 RW_Loop: ! If the screen is touched, the interrupt ! code will change xdoMemu to 1 (true) ! and call xdosend BT.STATUS s IF s<> 3 PRINT "Connection lost" GOTO fin ENDIF a1$="" dr=0 do pause 100 until dr=1 !gr.modify p1, "text",recept$ ! gr.Show p1 ! gr.render ! pause 500 ! == Traitement trame recue == !print 70 KL=0 KL=len(recept$) !debug.print recept$ !print "Lg Tr=";KL if (KL>76) then KL=0 !print 71 !debug.print " anomalie chaine trop longue" longueur=0 else ! test indirect si Ublox OK (nb satellites>=4 et GPSFIX>0) M3= Is_In("OK",recept$) !debug.print "M3=";M3 !print "M3";M3 if (M3>0) then gosub My_Split !debug.print "nb elem rec_Array$ : ";longueur for i=1 to longueur debug.print i,rec_Array$[i] next i Lo$=rec_Array$[2] La$=rec_Array$[3] ! issue de la liaison GPS via BT ou forcées pour tests debug.print "La$=";La$ debug.print "Lo$=";LO$ Latitude=val(La$) longitude=val(Lo$) ! rappel defaut path for data is ../sdcard/rfo-basic/data/ ! direct link for test with google chrome a$=right$(format$("%#",Z),2) Zoom$="&zoom=" + a$ Coordonnes$= format$("##%.#######", Latitude) + ","+ format$("##%.#######", Longitude) debug.print "Coordonnes =" ;Coordonnes$ Url$="https://maps.googleapis.com/maps/api/staticmap?" Url$=Url$ +Zoom$ Url$=Url$ + "&size=858x480&maptype=hybrid" + "&sensor=false"+ "&markers=" Url$=Url$ + Coordonnes$ !Url$="" !Coordonnes$=La$+","+Lo$+"," !print "Coordonnes =" ;Coordonnes$ !Z=15 !a$=right$(format$("%#",Z),2) !Zoom$=a$+"z" !Url$="https://www.google.com/maps/place//@"+Coordonnes$+Zoom$ html.load.url Url$ debug.print " URL =" ;right$(Url$,16) pause 4000 texte$=Url$ gr.modify p1,"text",texte$ gr.Show p1 gr.render tone 235,250,0 pause 2000 !Z++ !if(Z>20) Then !Z=12 !endif else print "Nb de sat. insuffisants Ublox BAD " endif % test si Ublox OK endif % test longuer trame recue nbb=nbb+1 ! Debug.print "boucle ";nbb if nbb<100 then % limite pour les test pause 100 goto RW_Loop endif HTML.Close gr.close Debug.print "sortie normale de Prog." Console.save Prog$+".txt" goto fin !====================================== ! Get and send message ! to the connected device xdoSend: INPUT "Text to send", wmsg$ PRINT "Me: "; wmsg$ k=len(wmsg$) if (k>16) wmsg$=left$(wmsg$,15) endif BT.WRITE wmsg$;chr$(13) xdomenu=0 RETURN ! When Console is touched ! set xdoMenu to true onConsoleTouch: xdoMenu=1 gosub xdosend ConsoleTouch.Resume My_Split: ! La Difference avec la fonction basic split qui necessite un tableau NON dimensionné ! avant usage .. donc ne pas ooublier le undim ! ! est qu'il n' y a besoin de dimensionner qu'une seule fois le tableau à son maxi ! et surtout que la fonction est rerentrante ! debug.print "My_Split" J3=1 L3=1 longueur=0 do M3= Is_In(",",recept$,L3) K3=len(recept$) if (M3>0) then rec_Array$[J3]=mid$(recept$,L3,M3-1) longueur=longueur + 1 recept$=right$(recept$,K3-M3) J3=J3+1 endif until M3=0 return OnBtReadReady: if test=0 ! Read messages until the message queue is empty msgR$="" a1$="" dr=0 DO BT.READ.READY rr IF rr dr=1 pause 100 bt.read.bytes A1$ msgR$=msgR$+a1$ end if until rr=0 recept$=msgR$ Bt.onReadReady.Resume ONERROR: debug.print GETERROR$() Debug.print "sortie sur Erreur" fin: Console.save "Err_"+Prog$+".txt" ! BT.CLOSE pause 2000 end END