Examples | Shop
 
DS-GPM and ISLCD220 Controlled by the OOPicII microcontroller.


 
The following example application demonstrates the use of the DS-GPM - Global Positioning Module.

The OOPicII microcontroller reads the DS-GPM’s internal registers through the IIC bus and displays the results via a serial connection to the ISLCD220 (comprising of a DS-LCDD2 module and 2x20 alphanumeric LCD).

After an initial introduction screen, the LCD moves through screens displaying the Time and Date, Speed and Direction, Latitude and Longitude.


Set-Up
OOPicII   DS-GPM
Pin 1 - IIC Input (SDA)
Pin 3 - IIC Input (SCL)
Pin 23 - IIC Input (GND)
Pin 2 - 6-16V -Ve
Pin 4 - 6-16V +Ve
OOPicII   ISLCD220
Pin 12 - Serial Connector (Si)
Pin 21 - Serial Connector (+Ve)
Pin 24 - Serial Connector (GND)

Power Supply
OOPicII Power: 6-16V DC (e.g. a PP3 9V battery)

DS-GPM Start Up
The DS-GPM has several start conditions.

Cold Start Mode
On first power up, it is in Cold Start Mode. The GPM doesn’t know where it is on earth initially so it must hunt for groups of satellites to determine its location. This may take up to 30 minutes. It is suggested that a battery be connected and the GPM be left ion the open air until the status indicator starts to flash.

Warm Start Mode
This applies to a GPM that has already been cold started and whose location has not been changed significantly. The unit is ready to go after approximately 45 seconds.

Hot Start Mode
This applies when the unit has been powered of for less than 60 minutes. Information is available after about 20 seconds.

For more details see the data sheet
HERE.

 

'********************************************************************
'********************************************************************
'Description: DS-GPM controlled by an OOPicII microcontroller connected to a
'DS-LCDD2 Serial/IIC LCD. This application demonstrates reading of internal registers
'and displaying results on an LCD screen.
'Created: 10/11/02 Revision: 1.0
'Version: B.1.0 Written By: Total Robots (Jamie Finnan)
'Adapted from: Designer Systems Original Code
'
'TR-020
'
'********************************************************************
'********************************************************************
Dim GPM As New oi2c
Dim LCD As New oLCDSE 'LCD object
Dim RTS As New oDio1
Dim Hours As New oByte 'Hours storage register
Dim Minutes As New oByte 'Minutes storage register
Dim Seconds As New oByte 'Seconds storage register
Dim Day As New oByte 'Day storage register
Dim Month As New oByte 'Month storage register
Dim Year As New oWord 'Year storage register
Dim Heading As New oWord 'Heading storage register (1 degree accuracy)
Dim Speed As New oWord 'Speed storage register (1 kmh accuracy)
Dim Latitude As New oWord 'Latitude storage register (1 degree accuracy)
Dim Longitude As New oWord 'Longitude storage register (1 degree accuracy)
Dim Count As New oByte
'********************************************************************
Sub Main()
oopic.delay = 400 'Wait 4 seconds for GPM to initialise
Const GPMAdr = &h68 'GPM A0 & A1 jumpers ON (Range &h68-&h6B)
LCD.IOLine = 12 'LCD is on IOLine 12 (Pin 12)
LCD.Clear 'Clear LCD screen
LCD.String=" GPM & DS-LCDD2 " 'Write to LCD screen.
LCD.Value=254 'Send command value to LCD.
LCD.Value=192 'Set second line value on LCD.
LCD.String="Example Application." 'Write to LCD screen.
oopic.delay = 200 '2 second delay.
LCD.Clear 'Clear the screen.
RTS.IOline = 24
RTS.Direction = cvOutput 'Ensure RTS line is high (ready for communication)
RTS = cvOff
Call SetUpGPM 'Setup GPM ready for information retrieval
do
'********************************************************************
' Stores time, date, heading and speed in registers defined above
'********************************************************************
count = 0
call StoreGPTD 'Store time and date
call StoreGPHS 'Store heading and speed
call StoreGPLL 'Store longitude and latitude
'********************************************************************
' Send time, date, heading & speed to LCD as displayable output
'********************************************************************
While count<3 'Loop constuct to show second count
GPM.Location = 0 'Point to R0
LCD.String = "Time = "+chr$(GPM+48)+chr$(GPM+48)+":
"+chr$(GPM+48)+chr$(GPM+48)+":"+chr$(GPM+48)+chr$(GPM+48)
LCD.Value = 254 'Command value
LCD.Value = 192 'Move to second line
LCD.String = "Date = "+chr$(GPM+48)+chr$(GPM+48)+"/"+chr$(GPM+48)+chr$(GPM+48)+"/
"+chr$(GPM+48)+chr$(GPM+48)+chr$(GPM+48)+chr$(GPM+48)
OOPic.Delay = 70 Small delay
count = count+1 'Increment file by 1 until count = 3
LCD.Clear 'Clear LCD
Wend 'End while statement

LCD.Clear 'Clear LCD
GPM.Location = 46 'Point to R46
LCD.String = "Heading = "+chr$(GPM+48)+chr$(GPM+48)+chr$(GPM+48)+".
"+chr$(GPM+48)+"deg"
LCD.Value = 254
LCD.Value = 192
LCD.String = "Speed = "+chr$(GPM+48)+chr$(GPM+48)+chr$(GPM+48)+".
"+chr$(GPM+48)+"kmh"

oopic.delay = 300 'Wait 3 seconds
LCD.Clear

GPM.Location = 14 'Point to R46
LCD.String = "Latitude = "+chr$(GPM+48)+chr$(GPM+48)+chr$(GPM+48)+".
"+chr$(GPM+48)+"deg"'+chr$(&h0d)+chr$(&h0a)
LCD.Value = 254
LCD.Value = 192
LCD.String = "Longitude= "+chr$(GPM+48)+chr$(GPM+48)+chr$(GPM+48)+"
."+chr$(GPM+48)+"deg"'+chr$(&h0d)+chr$(&h0a)+chr$(&h0a)

OOPic.delay = 300
LCD.Clear

loop

End Sub
'********************************************************************
' Subroutine to setup I2C communication to DS-GPM
'********************************************************************
Sub SetUpGPM()
'********************************************************************
'Set the DS-GPM I2C address shifted right by 1 bit
'********************************************************************
GPM.Node = GPMAdr 'Setup I2C address for GPM

'********************************************************************
'Setup I2C addressing to GPM
'********************************************************************

GPM.Width = cv8bit 'Control Info is 1-byte
GPM.Mode = cv10bit 'I2C mode is 10-Bit Addressing
GPM.NoInc = cvFalse 'Increment on every read/write

End Sub
'********************************************************************
' Subroutine to store time and date as values
'********************************************************************
Sub StoreGPTD()

GPM.Location = 0 'Start at R0
Hours = (GPM*10)+GPM 'Store hours
Minutes = (GPM*10)+GPM 'Store minutes
Seconds = (GPM*10)+GPM 'Store seconds

Day = (GPM*10)+GPM 'Store day
Month = (GPM*10)+GPM 'Store month
Year = (GPM*1000)+(GPM*100)+(GPM*10)+GPM 'Store year

End Sub
'********************************************************************
' Subroutine to store heading and speed as values
'********************************************************************
Sub StoreGPHS()

GPM.Location = 46 'Start at R46
Heading = (GPM*100)+(GPM*10)+GPM 'Store heading in degrees
Speed = (GPM*100)+(GPM*10)+GPM 'Store speed in kmh

End Sub
'********************************************************************
'Subroutine to store latitude and longitude as values
'********************************************************************
Sub StoreGPLL()

GPM.Location = 14
Latitude = (GPM*100)+(GPM*10)+GPM 'Store latitude in degrees
Longitude = (GPM*100)+(GPM*10)+GPM 'Store longitude in degrees

End Sub
'********************************************************************
'********************************************************************

Examples | Shop