السلام عليكم
هذا هو الكود
كود:
define OSC 8
'for GPS
symbol ser_out = porta.0
symbol H_ser_out = portb.3
symbol H_ser_in = portb.2
' general variables
x var byte[60]
' the settings
osccon =%01111111 'the INTOSC is set to be 8 MHz
trisa=0 'All of the porta is output
trisb=%00000101
trisc=0
trisc.7=1 'All of PortC is Output
trisd=0 'All of PortD is Output
trise=0 'All of PortE is Output
wdtcon=0
' the initial values
porta=0
portb=0
portc=0
portd=0
porte=0
pause 100
gosub pulse
main:
loop: ' this loop for checking the validity of GPS Data
serin2 H_ser_in,188,[wait("$GPRMC,"),str x\60]
IF X[11]<>"A" THEN loop ' A means the data valide
ser_out=1
serout2 ser_out,188,["Time :",x[0],x[1],":",x[2],x[3],":",x[4],x[5],13]
serout2 ser_out,188,["Date :",x[50],x[51],"-",x[52],x[53],"-",x[54],x[55],13]
serout2 ser_out,188,["Latitude :",x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],13]
serout2 ser_out,188,["Longitude :",x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],13]
goto main
' this sub program is for generating pulses.
pulse: ' low speed pulse
portb.1=1
pause 1000
portb.1=0
pause 1000
return
ملاحظة المايكروكونترولر الذي استخدمه هو PIC18F4520
وسأرفق الدائرة قريبا ان شاء الله
ولا تنسانا من دعائك الصالح
والسلام عليكم