  # Mr_Fid

Members+

6

## Community Reputation

0 Neutral

• Rank
RC-Cam Visitor
• Birthday 10/19/1972

## Contact Methods

• MSN
martinfiddy@hotmail.com
• Website URL
http://pages.zoom.co.uk/mfiddy
• ICQ
0

## Profile Information

• Location
Bungay, East Anglia, Britain, UK.
• Interests
Radio controlled speed boats<br>Restoring Cars and Camper (see website)<br>
1. Hello I Use the Mikroelektronika EasyPIC 4 development board, which i find really easy to use, its also cheap! (well i think it is for what you get) Start with a 16F84A pic which is flash programable and have a play, you get a code editing program with the board which allows you to write in basic, so its easy to get started. EasyPIC4 Martin
2. second half, as its to long in one post! 'This is the calculation for Knots to MPH, there are two calculations 'depending on where the decimal point is. the calculation is only done when the 'display is correct ie it is showing the mph and not the time. if display = 0 then if MSpeed02="." then mphspeed=((Mspeed01-48)*100)+((Mspeed03-48)*10)+(Mspeed04-48) mphspeed=mphspeed*115 mphspeed=mphspeed/100 k=0 else mphspeed=((Mspeed01-48)*100)+((Mspeed02-48)*10)+(Mspeed04-48) mphspeed=mphspeed*115 mphspeed=mphspeed/100 k=1 end if wordtostr(mphspeed,mphlcd) 'now convert it to a string for the LCD end if 'This is the calculation which adds an hour to the time, it addsan hour then checks the 'value isnt ASCII caractor 58 (, if it is 58 then you need to reset the hours units 'to zero and add an hour to the tens. again this routine is only done when the time is 'being displayed if display = 1 then time01c=time01 time02c=time02+1 if time02c=58 then time02c=48 time01c=time01c+1 end if end if 'now we have the display routines, the LCD is a small 8 * 2, j sets the number of times 'the display is looped this creats a delay so the time is only shown for about 4 seconds 'and the speed and altitude are show for about 14 seconds, there are two display routines 'for the speed depending on where the decimal point was, which was determined in the speed 'calulation above if display = 0 then j = 30 Lcd_Out(1,1,Galt) if Galt="," then Lcd_Out(1,4," ") end if Lcd_Out(1,5," Mtr") if (WriteFlag = 1) and (k = 0) then if mphlcd = 32 then lcd_chr(2,1,"0") else Lcd_chr(2,1,mphlcd) end if Lcd_chr(2,2,".") if mphlcd = 32 then lcd_chr(2,3,"0") else Lcd_chr(2,3,mphlcd) end if if mphlcd = 32 then lcd_chr(2,4,"0") else Lcd_chr(2,4,mphlcd) end if Lcd_out(2,5," MPH") Lcd_Cmd(Lcd_Cursor_Off) end if if (WriteFlag = 1) and (k = 1) then Lcd_chr(2,1,mphlcd) Lcd_chr(2,2,mphlcd) Lcd_chr(2,3,".") if mphlcd = 32 then lcd_chr(2,4,"0") else Lcd_chr(2,4,mphlcd) end if Lcd_out(2,5," MPH") Lcd_Cmd(Lcd_Cursor_Off) end if end if if display = 1 then j = 12 if WriteFlag = 1 then Lcd_out(1,1,"Time ") Lcd_Chr(2,1,time01c) Lcd_Chr(2,2,time02c) Lcd_out(2,3,":") Lcd_Out(2,4,time03) Lcd_Out(2,6,":") Lcd_Out(2,7,time04) end if end if WriteFlag = 0 wend end. _________________ EasyPIC4 user.
3. OK here is the code!! program Paraglider1 'this is a working program which reads 3 strings dim Gstr as string 'from a gps unit, it then converts Knots to MPH dim KSpeed as string 'adds an hour to the time, and formats the readings dim MSpeed01 as char 'to display on a lcd in a cycle, dim MSpeed02 as char 'first screen is Speed in MPH and alitude in Mtrs dim MSpeed03 as char 'Second screen is Time hh/mm/ss 24hr clock dim MSpeed04 as char ' dim mphspeed as word ' dim mphlcd as string ' dim time01 as char 'First digit of the time string (hours tens) dim time02 as char 'Second digit of the time string (hours unit) dim time03 as string 'Minutes saved as a string dim time04 as string 'Seconds saved as a string dim time01c as char 'modified hours ten for GMT + 1hour dim time02c as char 'modified hours units for GMT + 1hour dim GAlt as string 'Alitude dim i as byte ' dim k as byte ' dim j as byte ' dim WriteFlag as byte ' dim display as byte 'selects which screen so show on LCD dim counter as byte 'Selects how lond each screen is shown Sub function ReadChr as byte 'loop untill the rs is ready do loop until Usart_Data_Ready <> 0 result=Usart_Read end sub sub procedure CopyGStr(dim start as byte, dim l as byte, dim byref txt as string) dim y as byte for y=0 to l txt[y]=Gstr[start+y] next y txt[l]=chr(0) end sub main: cmcon=0x07 trisa=0x00 portb=0xff mphspeed = 0 display = 0 counter = 0 Lcd_Config(porta,1,0,7,6,portb,4,6,5) usart_init(4800) WriteFlag=0 Lcd_Out(1,1,"Waiting") Lcd_Out(2,1,"No Fix!") while true do i=ReadChr loop until i=36 i=0 do Gstr=ReadChr if Gstr="*" then i=0 else i=i+1 end if loop until (i=0) or (i=65) 'once the string has been read you need to check which string it is, i am interested in 'two stings, the first string is \$GPRMC this holds the time and speed. 'the second string i am interested in is \$GPGGA which holds the alitude if (Gstr="R") then 'must be the \$GPRMC STRING WriteFlag = 1 'set write flag CopyGstr(44,4,KSpeed) 'copy whole string first (not needed now) MSpeed01=Gstr 'first number Mspeed02=Gstr 'second number or a "," if low number MSpeed03=Gstr 'third number or a "," if high number MSpeed04=Gstr 'Last digit time01=Gstr time02=Gstr copyGstr(8,2,time03) copyGstr(10,2,time04) end if if (Gstr="G") then Writeflag = 1 CopyGstr(51,4,Galt) end if counter = counter+1 if counter = j then counter = 0 display = display+1 lcd_Cmd(Lcd_Clear) end if if display = 2 then display = 0 end if
4. Hello Mark, Thanks for your reply, and sorry it's taken so long to reply! (been busy) Thanks again Martin
5. Hello Just a quick question for ThomasScherrer.. i have had a search for calculating checksums, but i dont get it, can you explain how i would calculate a check sum for the 411? i would like to turn off some of the unused strings
6. Hello Thought I would just add a post, to say thanks for your knowledge and help, I brought a couple of GPS modules a while ago and have been working on a few projects using them, Any way to cut a long story short I have now finished one of the projects and it works well. It is a GPS Speedo and altimeter, and a clock! Not sure how good the altimeter will be but I will find out! And what’s it for??? Well my latest hobby is flying (crashing) paramotors. If any one wants more details including the source code them I am happy to share that. PIC 16F648A Using internal 4Mhz Oscillator and taking in the RS string from the GPS. Convert the Knots to MPH, Add an hour to the Time and send it all to a LCD with the Altitude. Sharing this project with you lot might get more of a response than the “That’s nice dear” from my women!! Take care Martin
7. Just to let your know that i recived my Modules ok. Thanks (i could have got them in Britain but twice the price!) Managed to get them working really quickly conneted to a PIC and displaying what ever data i wanted from the output onto a lcd.
×
×
• Create New...