SKYLAB SKM53 GPS and the AXE133

marks

Senior Member
Its that dreaded tax time ! The other day we had some wild weather in Perth and decided to get stuck into it.
After a few hours at about 2:30pm we had an area wide power outage it lasted until about 9:00pm.
All that work lost on that PC it allways seems to happen to me ! in frustration tax is pushed back in the corner.

My water retic has been off all winter,its been raining .In early hours of the morning I can hear water running,
the retics on its last station 2 minutes remaining I hate batterybackup...loss of power has reset it to a daily default starttime
Years ago I bought a skylab SKM53 ,I haven't got around to making that outside clock ,maybe a water controller , pool timer or logger
may be a better uses , but before I start buying things I'd like to see if I can write some workable useful code to get started.

I bought this thing cheap on ebay because it looked small and didn't appear to have a battery.
But reading the data sheet says it has an internal battery which must be well and truly flat by now.
For best results needs 5v , a supply capable of at least 150ma,decouplin 10uF and 1uF,pullups on tx and rx , 9600 baud TTL levels at 2.85v

I hooked up a usb to ttl adapter with the the skm53 pins 1(vcc 5v) 2(gnd) and 5(tx)
but on the PE serial terminal was receiving nothing but garbage this had be stumped for a while!
luckily I tried the the Oled axe133 with the axe027 the code I had left on their was outputting voltage value to the serial terminal
at different places ?? was sometimes appearing within the sent data. I hadn't seen this before.
It was still programming fine but doing this on all usb ports using w10.

I still have an older computer with w7 it just had PE555, trying the axe133 serial was now working correctly.
damm! now when I try the skm53 with the usb to ttl it is outputting all sentences to the serial terminal correctly!
loaded the latest PE6 works fine .download and tried some code I previously wrote ,the axe133 is now sending
$gprmc sentence to the terminal. I'm starting to like w7 more and more.

Moving back to my w10 computer with the axe133 and axe027. at least I'm seeing the $gprmc sentence but with extra ?? everywhere.
So the problem seems to be PSU, hopefully not the motherboard ,unlikely but maybe an update problem which I noticed it did do after
the power came back on. Have to sort this out after my tax is done lol.

Back to some code writing..
We output the $gprmc sentence to serial terminal the only difference is $7D
the last two hex characters are the checksum will be shown as a binary number instead 125

Maybe because the battery is flat it may take a while to get started ie 10s
onthe oled it will display "marks" until valid data or no checksum error is sent
it will then show the time in 12 hr format with seconds.
having no external antenna was a bit worried but once started works faultlessly.

the $gprmc sentence gives you utc time just change your time zone hours which can be
negative also ie. (-9) can be entered (Worldwide)
the example is given for Adelaide. 9 hrs 30 mins dst=1
the updated day (fri) and date is also shown at the end of the $gprmc sentence in the serial terminal.

DST is only for Australia or new Zealand you will need to alter that part for others like uk or us
I did read somewhere the EU was doing away with DST by 2020 lol.
here in wa we have a silly minority group trying to introduce it

The Oled with skm53(quotes50ma) seems to draw about 60ma
when I look for some parts I may look at trying the neo7 which has the same sentence and is quoted @ 22ma
 

Attachments

marks

Senior Member
Code:
#no_data
#terminal 38400
#picaxe 18m2 ' AXE133 marks
' DB7 = B.7
' DB6 = B.6
' DB5 = B.5
' SCL DB4 = B.4
' DB3 = B.3
' DB2 = B.2
' SDA DB1 = B.1
' DB0 = B.0
SYMBOL Rx = C.5
SYMBOL E = C.6
SYMBOL RS = C.7
SYMBOL GPS = C.0
SETFREQ M32 'read GPS data at 9600 baud standard default
dirsB = %11111111
dirsC = %11001111
SYMBOL senddata = pinsb
SYMBOL index = b0
SYMBOL secs = b1 SYMBOL CRC = B1
SYMBOL mins = b2 SYMBOL Checksum = B2
SYMBOL hours = b3
SYMBOL date = b4 SYMBOL Datebptr = B4
SYMBOL month = b5
SYMBOL year = b6
SYMBOL Day = b7
SYMBOL CommonYear = b8
SYMBOL PM_AM = b9 SYMBOL Lastday =B9
SYMBOL AuNzDST = b10
SYMBOL DayNumber = W6
SYMBOL DSTend = W7
SYMBOL DSTstart = W8 SYMBOL DayS = W8
SYMBOL CRCerrors = W9
SYMBOL D0 = b20
SYMBOL D1 = b21
SYMBOL D2 = b22
SYMBOL D3 = b23
SYMBOL D4 = b24
SYMBOL D5 = b25
SYMBOL TimeZoneMins = b26
SYMBOL TimeZoneHours = b27
;--Settings-------------------------------------------------------------;
TimeZoneHours = 9 ' example Adelaide
TimeZoneMins = 30
AuNzDST = 1 ' =0 StandardTime =1 for AuDST =2 for NzDST
;--Settings-------------------------------------------------------------;
InitialiseOLED:  
FOR index = 0 to 6
LOOKUP index, ($38,$38,$38,$0C,$01,$02,$06),senddata : PULSOUT E,1 ' Initialise LCD/OLED
'(8bit/2line/5x8)*3(Display On)(Clear Display)(Return Home)(Entry Mode Set)
NEXT index : PAUSE 10

LOW RS : senddata = 130 : PULSOUT E,1 ' CommandMode (128-147) Line 1 Cursor Position
HIGH RS ' CharacterMode
FOR index = 0 TO 4 ' sending characters to LCD line one
LOOKUP index,("marks"),senddata : PULSOUT E,1
NEXT index
Main:
GPS_SKM53:
bptr = 28
SERIN gps,t9600_32,("RMC"),@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc

GPSmessageCRC:
SERTXD (13,10," $GPRMC,")'$GPRMC,HHMMSS.sss,A,DDMM.mmmm,S,DDDMM.mmmm,E,0.00,88.53,DDMMYY,,,D*7D
bptr=29
CRC=103 ' seed GPRMC,
DO until @bptr="*" ' crc = XOR all characters between $ and *
SERTXD(@bptr)
CRC=CRC XOR @bptrinc
LOOP
SERTXD(@bptr) '*
datebptr=bptr-10

CRCchecksum: ' convert ascii $x+$x to bin
inc bptr : @bptrinc = @bptr /64 *9 + @bptr *16
Checksum = @bptr /64 *9 + @bptrdec &$0F +@bptr
SERTXD(#Checksum," ")
IF CRC <> Checksum THEN :INC CRCerrors : SERTXD (CR,LF, "Checksum Error ",#CRCerrors) : GOTO Main : ENDIF
bptr =40 : IF @bptr <> "A" THEN : SERTXD(@bptr) : GOTO Main : ENDIF ' A=data valid or V=data not valid
 GPStime:  bptr  = 29
hours = @bptrinc *10 + @bptrinc -16 +TimeZoneHours
mins = @bptrinc *10 + @bptrinc -16 +TimeZoneMins
secs = @bptrinc *10 + @bptrinc -16 ' convert ascii x+x to bin

IF mins >127 THEN : dec hours : ENDIF
IF mins > 59 THEN : inc hours : ENDIF
Day=0 : mins = mins//60
IF hours > 230 THEN : hours=hours+24 : day=-1 : ENDIF 'negative Timezone
IF hours > 23 THEN : hours=hours-24 : day= 1 : ENDIF 'positive TimeZone

GPSdate: bptr = datebptr
date = @bptrinc *10 + @bptrinc -16 +day
month = @bptrinc *10 + @bptrinc -16
year = @bptrinc *10 + @bptrinc -16

CommonYear = year //4 +3 /4 'CommonYear =1
Adjustdate:
IF date =0 THEN : dec month
IF month =0 THEN : month =12: dec year : ENDIF
ENDIF : Lastday =31
IF month =4 or month =6 or month =9 or month =11 THEN : lastday =30: ENDIF
IF month =2 THEN : Lastday = 29 -CommonYear : ENDIF
IF date =0 THEN : date =lastday: ENDIF
IF date >Lastday THEN : date =1 : month=month//12+1
IF month=1 THEN : INC year : ENDIF
ENDIF

DayNumberOfTheYear:
DayNumber = month +9 /12
DayNumber = CommonYear + DayNumber * DayNumber
DayNumber = month *275 /9 +date -30 -DayNumber
DayOfWeek:
DayS = year *512 **46752 'year2001-99
Day = days + DayNumber //7 'Sat=0 Sun=1 Mon=2 Tue=3 Wed=4 Thu=5 Fri=6

;--DSTadjust------------------------------------------------------------------------;
AustralianNewZealandDST:
IF AuNzDST <>0 THEN
DSTend = Days +96 //7
DSTend = 98 -CommonYear -DSTend 'First Sunday in April AuNz
IF AuNzDST =1 THEN
DSTstart = Days +279 //7
DSTstart = 281 -CommonYear -DSTstart 'First Sunday in October Au
ENDIF
IF AuNzDST =2 THEN
DSTstart = Days +272 //7
DSTstart = 274 -CommonYear -DSTstart 'Last Sunday in September Nz
ENDIF
IF DayNumber > DSTend AND DayNumber < DSTstart THEN DisplayTime
IF DayNumber = DSTstart AND hours <2 THEN DisplayTime ' DST starts at 0200
IF DayNumber = DSTend AND hours >1 THEN DisplayTime ' DST ends at 0200
'------------------------------------------------------------------------------'
IF hours =23 THEN : inc date : day=day+1//7
IF date >Lastday THEN : date =1 : month=month//12+1
IF month=1 THEN : INC year : ENDIF
ENDIF
ENDIF : hours =hours +1//24
ENDIF
;--DSTadjust------------------------------------------------------------------------;
 DisplayTime:
IF day =0 THEN sertxd ("SAT"):ENDIF
IF day =1 THEN sertxd ("SUN"):ENDIF
IF day =2 THEN sertxd ("MON"):ENDIF
IF day =3 THEN sertxd ("TUE"):ENDIF
IF day =4 THEN sertxd ("WED"):ENDIF
IF day =5 THEN sertxd ("THR"):ENDIF
IF day =6 THEN sertxd ("FRI"):ENDIF
sertxd (" ",#date,"/",#month,"/20",#year," ") ' Date dd/mm/20yy

ClockDisplay:
PM_AM = "P" : IF hours <12 THEN : PM_AM ="A": ENDIF ' Indicate PM or AM
   hours = hours //12 : IF hours =0 THEN: hours =12 : ENDIF ' 24 to 12 hour format
   D5 = hours  /10 +$30 : IF D5 = "0" THEN : D5 = " " : ENDIF 'Zero blanking    
D4 = hours //10 +$30
D3 = mins /10 +$30
D2 = mins //10 +$30
D1 = secs /10 +$30
D0 = secs //10 +$30

LOW RS : senddata = 128 : PULSOUT E,1 ' CommandMode (128-147) Line 1 Cursor Position
HIGH RS ' CharacterMode
FOR index = 0 TO 10 ' sending characters to LCD line one
LOOKUP index,(D5,D4,":",D3,D2,":",D1,D0," ",PM_AM,"M"),senddata : PULSOUT E,1
NEXT index
GOTO main
 
Top