BS2p40
SpyBot
Posts: 3
Hello everyone,
I have a question about the BS2P40 module in combination with a Pro.Dev.Board.
I am using the parallax GPS receiving module (28146) but i cannot receive any signal from the GPS module. I tryd the code on the Pro.Dev.Board in combination with a BS2 module and everything worked fine. But when im using the BS2P40 module i cannot get a goo connection with the GPS module eventhough the GPS modula has a clear signal from the sattelites (red light doesnt flas but is constant).
Please help me!!! I guess the solution is pretty easy because i guess therre is just something wrong with the baudrate. I just cant find what!
Greatings
Frank o.b.o. the project SpyBot
The complete code i am using is the following:
'
[ I/O Definitions ]
'lcd PIN 0
'transceiver
txrx PIN 1
dat PIN 0
'RX PIN 15 ' Receive Data <-- 27937.5 (TXD)
'TX PIN 14 ' Transmit Data --> 27937.4 (RXD)
RAW PIN 15 ' GPS /RAW (Low for RAW mode)
GPS PIN 14 ' GPS SIO
'
[ Constants ]
Mode CON 0 ' Altitude Mode (0 = Clamp/Ground)
T9600 CON 84
Inverted CON $4000 'Value for inverted serial format
Baudtx CON T9600+Inverted ' (1 = Show Altitude)
Baud CON 84 ' Serial Baud Rate 9600 bps (BS2)
GPSBaud CON 32956 ' 4800 Baud (Open Mode)
NumSamples CON 10 ' Number Of Samples To Log
Interval CON 5 ' Seconds Between Samples
GetValid CON $01 ' GPS Signal Valid?
GetLat CON $05 ' GPS Latitude
GetLong CON $06 ' GPS Longitude
GetAlt CON $07 ' GPS Altitude (Meters)
'
[ Variables ]
buffer VAR Byte(10) ' Input Buffer
index VAR Byte ' Index Variable
ioByte VAR Byte ' Input/Output Storage
flag VAR Bit ' Event Status Flag
error VAR Bit ' Timeout Error Flag (1 = Timeout)
valid VAR Bit ' GPS Signal Valid (1 = Yes)
logging VAR Bit ' Logging Data (1 = Yes, 0 = No)
workVal VAR Word ' Work Variable
degrees VAR Byte ' Latitude/Longitude Degrees
minutes VAR Byte ' Latitude/Longitude Minutes
minutesD VAR Word ' Lat/Long Decimal Minutes
dir VAR Byte ' Direction
alt VAR Word ' Altitude In 0.1 Meter Units
Init_gps:
AUXIO
DEBUG CLS, "Program Starting..."
'PAUSE 200 ' Allow Time To Settle
'HIGH TX ' Initialize Transmit Line
PAUSE 600 ' Allow Time To Settle
DEBUG "OK", CR, "Waiting for GPS signal...", CR
'
[ Program Code ]
GPS_Main:
DO
GOSUB Get_Valid ' Get Signal Status Of GPS
GOSUB Get_Lat ' Get/Write Longitude
DEBUG CR, "sending lat"
AUXIO
HIGH txrx
SEROUT dat, baudtx, ["XYZB?", DEC3 degrees, DEC4 workVal]
DEBUG CR, "lat send", CR
PAUSE 200
GOSUB Get_Long ' Get/Write Latitude
DEBUG CR, "sending alt"
AUXIO
HIGH txrx
SEROUT dat, baudtx, ["XYZB=", DEC3 degrees, DEC4 workVal]
DEBUG CR, "alt send"
'
[ Subroutines - GPS ]
Get_Valid:
SEROUT GPS, GPSBaud, ["!GPS", GetValid]
DEBUG "'" , CR
SERIN GPS, GPSBaud, [valid]
DEBUG "'" , CR
RETURN
Get_Lat:
SEROUT GPS, GPSBaud, ["!GPS", GetLat]
SERIN GPS, GPSBaud, [degrees, minutes,
minutesD.HIGHBYTE, minutesD.LOWBYTE, dir]
workVal = (minutes * 1000 / 6) + (minutesD / 60)
DEBUG " " + (dir * 13), DEC3 degrees, ".", DEC4 workVal, ","
' SEROUT TX, Baud, [$08, $20, $00, $00, $00, $0A, $0D,
' " " + (dir * 13), DEC3 degrees, ".", DEC4 workVal, ",", $0D]
' GOSUB Get_Data ' Purge Receive Buffer
DEBUG CR, "Get_Long finished!"
RETURN
Get_Long:
SEROUT GPS, GPSBaud, ["!GPS", GetLong]
SERIN GPS, GPSBaud, [degrees, minutes,
minutesD.HIGHBYTE, minutesD.LOWBYTE, dir]
workVal = (minutes * 1000 / 6) + (minutesD / 60)
DEBUG " " + (dir * 13), DEC degrees, ".", DEC4 workVal, ","
' SEROUT TX, Baud, [$08, $20, $00, $00, $00, $0A, $0D,
' " " + (dir * 13), DEC3 degrees, ".", DEC4 workVal, ",", $0D]
' GOSUB Get_Data ' Purge Receive Buffer
DEBUG CR, "Get_Long finished!"
RETURN
'Get_Data:
' index = 0 ' Reset Index Pointer
' error = 0 ' Reset Timeout Error
' DO ' Receive Data
' SERIN RX, Baud, 100, Timeout, [ioByte]
' buffer(index) = ioByte ' Add Received Byte To Buffer
' index = index + 1 ' Increment Index Pointer
' IF index > 9 THEN Timeout2 ' Check For Overflow
' LOOP
'
'Timeout:
' error = 1 ' Serial Timeout
'
'Timeout2:
' RETURN
I have a question about the BS2P40 module in combination with a Pro.Dev.Board.
I am using the parallax GPS receiving module (28146) but i cannot receive any signal from the GPS module. I tryd the code on the Pro.Dev.Board in combination with a BS2 module and everything worked fine. But when im using the BS2P40 module i cannot get a goo connection with the GPS module eventhough the GPS modula has a clear signal from the sattelites (red light doesnt flas but is constant).
Please help me!!! I guess the solution is pretty easy because i guess therre is just something wrong with the baudrate. I just cant find what!
Greatings
Frank o.b.o. the project SpyBot
The complete code i am using is the following:
'
[ I/O Definitions ]
'lcd PIN 0
'transceiver
txrx PIN 1
dat PIN 0
'RX PIN 15 ' Receive Data <-- 27937.5 (TXD)
'TX PIN 14 ' Transmit Data --> 27937.4 (RXD)
RAW PIN 15 ' GPS /RAW (Low for RAW mode)
GPS PIN 14 ' GPS SIO
'
[ Constants ]
Mode CON 0 ' Altitude Mode (0 = Clamp/Ground)
T9600 CON 84
Inverted CON $4000 'Value for inverted serial format
Baudtx CON T9600+Inverted ' (1 = Show Altitude)
Baud CON 84 ' Serial Baud Rate 9600 bps (BS2)
GPSBaud CON 32956 ' 4800 Baud (Open Mode)
NumSamples CON 10 ' Number Of Samples To Log
Interval CON 5 ' Seconds Between Samples
GetValid CON $01 ' GPS Signal Valid?
GetLat CON $05 ' GPS Latitude
GetLong CON $06 ' GPS Longitude
GetAlt CON $07 ' GPS Altitude (Meters)
'
[ Variables ]
buffer VAR Byte(10) ' Input Buffer
index VAR Byte ' Index Variable
ioByte VAR Byte ' Input/Output Storage
flag VAR Bit ' Event Status Flag
error VAR Bit ' Timeout Error Flag (1 = Timeout)
valid VAR Bit ' GPS Signal Valid (1 = Yes)
logging VAR Bit ' Logging Data (1 = Yes, 0 = No)
workVal VAR Word ' Work Variable
degrees VAR Byte ' Latitude/Longitude Degrees
minutes VAR Byte ' Latitude/Longitude Minutes
minutesD VAR Word ' Lat/Long Decimal Minutes
dir VAR Byte ' Direction
alt VAR Word ' Altitude In 0.1 Meter Units
Init_gps:
AUXIO
DEBUG CLS, "Program Starting..."
'PAUSE 200 ' Allow Time To Settle
'HIGH TX ' Initialize Transmit Line
PAUSE 600 ' Allow Time To Settle
DEBUG "OK", CR, "Waiting for GPS signal...", CR
'
[ Program Code ]
GPS_Main:
DO
GOSUB Get_Valid ' Get Signal Status Of GPS
GOSUB Get_Lat ' Get/Write Longitude
DEBUG CR, "sending lat"
AUXIO
HIGH txrx
SEROUT dat, baudtx, ["XYZB?", DEC3 degrees, DEC4 workVal]
DEBUG CR, "lat send", CR
PAUSE 200
GOSUB Get_Long ' Get/Write Latitude
DEBUG CR, "sending alt"
AUXIO
HIGH txrx
SEROUT dat, baudtx, ["XYZB=", DEC3 degrees, DEC4 workVal]
DEBUG CR, "alt send"
'
[ Subroutines - GPS ]
Get_Valid:
SEROUT GPS, GPSBaud, ["!GPS", GetValid]
DEBUG "'" , CR
SERIN GPS, GPSBaud, [valid]
DEBUG "'" , CR
RETURN
Get_Lat:
SEROUT GPS, GPSBaud, ["!GPS", GetLat]
SERIN GPS, GPSBaud, [degrees, minutes,
minutesD.HIGHBYTE, minutesD.LOWBYTE, dir]
workVal = (minutes * 1000 / 6) + (minutesD / 60)
DEBUG " " + (dir * 13), DEC3 degrees, ".", DEC4 workVal, ","
' SEROUT TX, Baud, [$08, $20, $00, $00, $00, $0A, $0D,
' " " + (dir * 13), DEC3 degrees, ".", DEC4 workVal, ",", $0D]
' GOSUB Get_Data ' Purge Receive Buffer
DEBUG CR, "Get_Long finished!"
RETURN
Get_Long:
SEROUT GPS, GPSBaud, ["!GPS", GetLong]
SERIN GPS, GPSBaud, [degrees, minutes,
minutesD.HIGHBYTE, minutesD.LOWBYTE, dir]
workVal = (minutes * 1000 / 6) + (minutesD / 60)
DEBUG " " + (dir * 13), DEC degrees, ".", DEC4 workVal, ","
' SEROUT TX, Baud, [$08, $20, $00, $00, $00, $0A, $0D,
' " " + (dir * 13), DEC3 degrees, ".", DEC4 workVal, ",", $0D]
' GOSUB Get_Data ' Purge Receive Buffer
DEBUG CR, "Get_Long finished!"
RETURN
'Get_Data:
' index = 0 ' Reset Index Pointer
' error = 0 ' Reset Timeout Error
' DO ' Receive Data
' SERIN RX, Baud, 100, Timeout, [ioByte]
' buffer(index) = ioByte ' Add Received Byte To Buffer
' index = index + 1 ' Increment Index Pointer
' IF index > 9 THEN Timeout2 ' Check For Overflow
' LOOP
'
'Timeout:
' error = 1 ' Serial Timeout
'
'Timeout2:
' RETURN
Comments
Is the code you posted the original code that was working on the other stamp or your revised code for the BS2p40? Also, are you using the same pins on both?
Robert
http://forums.parallax.com/showthread.php?p=757983
http://forums.parallax.com/showthread.php?t=122472
http://forums.parallax.com/showthread.php?t=110403
the first model on wich everything worked was a BS2 module. the code i placed is exacly the code that worked with the BS2, but when using the BS2P40 module, there seems to be no connection with the GPS module (Parallax GPS module) I can send things towards the sensor, but im not receiving anything!
grtz