Organiser II data logging

Feel free to discuss any harware topic here
NickKostelidis
Posts: 109
Joined: Wed Jan 27, 2021 8:23 am
Location: Athens - Greece
Contact:

Re: Organiser II data logging

Post by NickKostelidis »

Here I upload a simple routine.
That gets measured data from South surveying instruments.
It works with Topcon surveying instruments too.
For communication with Topcon instruments some parts of this routine are not absolutely necessary.
Attachments
SouthCom.opl
(1.81 KiB) Downloaded 52 times
NickKostelidis
Posts: 109
Joined: Wed Jan 27, 2021 8:23 am
Location: Athens - Greece
Contact:

Re: Organiser II data logging

Post by NickKostelidis »

For those who want to write a program for data collection from Topcon surveying instruments this manual will be very useful.
Attachments
3693-GTS-4.pdf
(45.29 KiB) Downloaded 56 times
NickKostelidis
Posts: 109
Joined: Wed Jan 27, 2021 8:23 am
Location: Athens - Greece
Contact:

Re: Organiser II data logging

Post by NickKostelidis »

And here is the interface manual for Nikon surveying instruments.
Attachments
Nikon surveying instruments interface manual.pdf
(3.12 MiB) Downloaded 52 times
Lepowerfulpierre
Posts: 9
Joined: Thu Jan 28, 2021 8:29 am

Re: Organiser II data logging

Post by Lepowerfulpierre »

What! Yesterday and not snowing in Athens?
NickKostelidis
Posts: 109
Joined: Wed Jan 27, 2021 8:23 am
Location: Athens - Greece
Contact:

Re: Organiser II data logging

Post by NickKostelidis »

Lepowerfulpierre wrote: Tue Feb 23, 2021 12:11 am What! Yesterday and not snowing in Athens?
We had snow in Athens for only two days Peter.
The next few days we have 18-20 degrees temperature.
NickKostelidis
Posts: 109
Joined: Wed Jan 27, 2021 8:23 am
Location: Athens - Greece
Contact:

Re: Organiser II data logging

Post by NickKostelidis »

This is a simble routine that gets measured data from Nikon surveying instruments.
The units for angles is "grad".
Attachments
NikonCom.opl
(1.6 KiB) Downloaded 47 times
User avatar
Lostgallifreyan
Posts: 27
Joined: Fri Jun 11, 2021 2:52 pm

Re: Organiser II data logging

Post by Lostgallifreyan »

Here's my general purpose data logger. It uses two-field data files, the first being a timestamp and the second being a comment. To use it, start by making sure there is a big fat RAMpack in slot B for the log file, especially if the LOGENTRY procedure is called for frequent automatic entry.. Also, make sure the power supply is healthy if editing early records in large files. Rechargeable lithium polymer batteries are a good choice.

It has a 'front end' called EVENT that is used for direct manual use of the program, and is also a basic template that is the place to start examining how to add the rest to other programs. EVENT will edit a file record and preserve its original position. This can be slow in the early end of a large file, but is a critical ability for an event logger.

There are several procedures, because this thing is modular, and can be accessed by GPS programs to log waypoints or by software defined radio controllers that log times and frequencies of events heard while listening, or to examine whether some beacon or other signal has already been logged and described.

Sometimes a fast access is needed, with editing of a record done later, in which case EXE can add an empty record (auto-commented as START) and switch the Organiser off, then ON will switch it on and add a record auto-commented as END, each with timestamps. This can be useful to log critically timed events with minimal user interaction. Beeps let you know that things happened. The key choices make this easy to use in the dark. If you fumble it, the worst it will do is add extra events which you can delete later.

EVENT is the top level procedure:

Code: Select all

EVENT:
GLOBAL LZ%,Q$(16),L$(250)
LOCAL F$(10),F%,N%
LZ%=LZTEST: :IF LZ% :POKEB $20A6,(PEEKB($20A6) AND 254)+1 :ENDIF :rem Force 24-hour clock on LZ.
ESCAPE OFF
F$="B:LOG"
IF EXIST(F$)
 OPEN F$,A,T$,E$
ELSE CREATE F$,A,T$,E$
 A.E$="" :APPEND :ERASE
ENDIF

F:: :F%=1
IF FILEMENU:(F$)
 WHILE LOGENTRY:(0)
  IF L$="" :L$="END"
   OFF :LOGENTRY:(1)
  ENDIF :L$=""
  WHILE KEY :ENDWH
 ENDWH :GOTO F::
ENDIF

E::
N%=NAVREC:(1,F%)
IF N% AND COUNT>0
 IF N%=-1 :TRAP ERASE
  IF EOF :LAST :ENDIF
 ELSEIF EDITFILE:(1)
  CLS :PRINT" SAVING DATA..."
  F%=POS :N%=COUNT-F%
  DO :UPDATE :POSITION F% :N%=N%-1 :UNTIL N%<0
 ELSE POSITION POS
 ENDIF :F%=0 :GOTO E::
ENDIF
GOTO F::
Test for LZ machines, as used above:

Code: Select all

LZTEST:
LOCAL N%
N%=PEEKB($FFE8) AND 8 :IF N% :N%=PEEKB($FFCB)>127 :ENDIF
RETURN N%
Main file menu:

Code: Select all

FILEMENU:(FN$)
LOCAL F%,D$(2)
F:: CLS
PRINT"ON=End MODE=EditEXE=Add DEL=Kill"
DO :F%=GET :UNTIL F%=1 OR F%=13 OR F%=2 OR F%=8
IF F%=1 :STOP :ENDIF
IF F%=2 :RETURN 0: :ENDIF
IF F%=13 :RETURN 1: :ENDIF
IF F%=8 :CLS :PRINT"DELETE ALL DATA?(Enter "+CHR$(34)+"OK"+CHR$(34)+") ";
 TRAP INPUT D$
 IF D$="OK" :CLOSE :DELETE FN$ :BEEP:(500,880) :STOP :ENDIF
ENDIF
GOTO F::
NAVREC does record navigation with keys A~F, and has search and delete tools.

Code: Select all

NAVREC:(W%,H%)
REM Input flags: W%=Write,H%=Help
LOCAL K%,P%,D$(6)
IF H%=1 :CLS :PRINT"A..F+MODE=SearchDEL=Nul EXE=Edit" :PAUSE -60 :ENDIF
 WHILE KEY :ENDWH
X::
WHILE 1
 IF EOF :CLS :PRINT"No Records Exist" :K%=GET
 ELSE K%=EDITFILE:(0)
 ENDIF
 P%=POS
 IF K%=1 :RETURN
 ELSEIF K%=65 :P%=1
 ELSEIF K%=66 :P%=COUNT
 ELSEIF K%=67 :P%=P%-10
 ELSEIF K%=68 :P%=P%+10
 ELSEIF K%=69 :P%=P%-1
 ELSEIF K%=70 :P%=P%+1
 ELSEIF K%=2
  CLS :PRINT"Find: 1-16 Chrs.";
  TRAP EDIT Q$ :IF ERR<>206 :NEXT :IF FIND(Q$)=0 :FIRST :IF FIND(Q$)=0
   CLS :PRINT"STRING NOT FOUND" :POSITION P% :GET :ENDIF :ENDIF :ENDIF :P%=POS
 ELSEIF K%=8
  IF W%
   IF OR:(" Delete Record?       ","Y","N",1) :RETURN -1 :ENDIF
  ELSE D$="DELETE" :GOTO D::
  ENDIF
 ELSEIF K%=13
  IF W% :RETURN P% :ELSE D$="EDITOR" :GOTO D:: :ENDIF
 ENDIF
 IF P%<1 :P%=1 :ENDIF
 IF P%>COUNT :P%=COUNT :ENDIF
 POSITION P%
ENDWH

D::
 CLS :PRINT D$+" DISABLED!" :PAUSE -20
 WHILE KEY :ENDWH
GOTO X::
EDITFILE combines a viewer and editor, and uses inbuilt 'system services' to do it:

Code: Select all

EDITFILE:(W%)
LOCAL C%(7),V%(4),E%(4),K%,X%,N%
C%(1)=$DD41     :rem  STD UTW_S0:
C%(2)=$01CE     :rem  NOP,LDX Source
C%(3)=PEEKW($2016)
C%(4)=$01CC     :rem  NOP,LDD Destination
C%(5)=$2187
C%(6)=$3F6D     :rem  SWI UT$CPYB
C%(7)=$3900     :rem  RTS (back to OPL)
USR(ADDR(C%()),255)
IF W% :GOTO E:: :ENDIF

V::
V%(1)=$01CE     :rem  NOP,LDD
V%(2)=$0001     :rem  Non-zero for new display
V%(3)=$3F1E     :rem  SWI ED$VIEW
V%(4)=$1839     :rem  XGDX,RTS (back to OPL)
RETURN USR(ADDR(V%()),0)

E::
E%(1)=$01CC     :rem  NOP,LDD
E%(2)=$01FE     :rem  Flags and length
E%(3)=$3F1C     :rem  SWI ED$EDIT
E%(4)=$1839     :rem  XGDX,RTS (back to OPL)
DO :CLS
 K%=USR(ADDR(E%()),0) AND 14
 X%=PEEKW($85)+PEEKW($87)
 N%=PEEKB($2187)
 IF K%=2 AND N%<254
  C%(3)=$2188+X%
  C%(5)=C%(3)+1
  USR(ADDR(C%()),254-X%)
  POKEB C%(3),9
  POKEB $2187,N%+1
 ENDIF
UNTIL K%<>2
C%(3)=$2187
C%(5)=PEEKW($2016)
USR(ADDR(C%()),255)
RETURN K%
LOGENTRY adds a new entry to a log file, either with user intervention, or automatically with existing data:

Code: Select all

LOGENTRY:(F%)
rem F%=force, returns 1 if edited else 0
IF F% :GOTO A:: :ENDIF
CLS
PRINT :PRINT"ON=End EXE=Enter";
AT 1,1 :PRINT"LOG:";
TRAP EDIT L$
IF ERR=206 :RETURN :ENDIF
A:: :LAST
A.T$="+"+TIME$: :A.E$=L$
IF L$="" :A.E$="START" :ENDIF
APPEND :BEEP:(40,7040)
RETURN 1
OR sets a user-defined binary choice, allowing ON and EXE for convenience when choices are Y and N:

Code: Select all

OR:(P$,X$,Y$,Z%)
LOCAL K%,S% :CLS
PRINT P$;X$;"/";Y$
S%=KSTAT:(Z%)
DO :K%=GET
 IF X$="Y" AND Y$="N"
  IF K%=13 :K%=%Y
  ELSEIF K%=1 :K%=%N
  ENDIF
 ENDIF
 IF K%=ASC(X$) OR K%=ASC(Y$)
  KSTAT S% :RETURN K%=ASC(X$)
 ENDIF
UNTIL 0
TIME$ makes the timestamps, which are formatted for easy temporal sort order in other systems.

Code: Select all

TIME$:
rem All 2-line Organisers need the YR2K fix to use this.
LOCAL D$(24)
D$=DATIM$
RETURN RIGHT$(NUM$(YEAR+(84 AND NOT LZ%),4),2)+RIGHT$(NUM$(MONTH+100,3),2)+MID$(D$,5,2)+" "+MID$(D$,17,8)
KSTAT acts like the OPL command, but passes the current state back so your code can restore it:

Code: Select all

KSTAT:(S%)
LOCAL X%
X%=LOC("()hi",CHR$((PEEKB($7B) AND 65)+40))
IF S% :KSTAT S% :ENDIF
RETURN X%
BEEP makes beeps easier to do, based on known frequency and duration:

Code: Select all

BEEP:(D%,F%)
BEEP D%,460800/F%-39
This thing is solid, it's been evolving slowly over nearly twenty years but has needed very few changes in recent years. It gets a lot of use.

One point of interest is the EDITFILE procedure which uses machine code to get at system services for editing. This allows editing to act like the top level menu file SAVE tool, it's a multi-line editor, which OPL can't do. The event logger can't search the extra fields that can be added to a record this way, but they can be read with a text editor when the ODB data file is saved to a computer, and Organiser programs can be written to use them in logs for specific purposes.

Other small points include the small auxiliary procedures that will likely have uses on their own. That's a lot of code for one program, but it saves a lot more space than it uses once you write other things that need any of it.
Post Reply