FT736R.3

Here are some routines to drive a Yaesu FT736R CAT interface. 

Note that the radio has TTL levels, so you need to build a circuit to
convert RS232 voltages to TTL voltages.  You can do this with a MAX231 etc,
or a couple of NPN transistors.  The latter can be mounted inside your
DB25 connector.

 1. The Yaesu spec contains one or two typos which are herein connected. 
 2. It does not appear to be necessary to space out the 5 control
    bytes by 50 ms.
 3. The READ S-meter, squelch functions smetimes fail to return all 5
    bytes, so the code (FNget) accomodates this.
 
 
REM
REM                 FT736R CAT Interface Drivers
REM                 ----------------------------
REM                  Last modified 1990 May 21
REM
REM                  (C)1990 J R Miller G3RUH
REM
REM  Procedures and functions available are:
REM
REM      PROCcat(on|off)
REM      PROCmode(lsb|usb|cw|cwn|fm|fmn)
REM      PROCptt(on|off)
REM      PROCsplit(off|plus|minus)
REM      PROCoffset(MHz)
REM      PROCfreq(MHz)                (* e.g. MHz = 145.6789
etc *)
REM      PROCfull_dup(on|off)
REM      PROCsat_mode(tx|rx , lsb|usb|cw|cwn|fm|fmn)
REM      PROCsat_freq(tx|rx , MHz)
REM      FNsqlch                      (* returns 0 if no
signal *)
REM      FNmeter                      (* returns S-meter value 
*)
REM
REM
REM        Example - prepare FT736R for FUJI-OSCAR-20
satellite
REM       
====================================================
PROCset_up:   REM Do once only per session!
PROCcat(on)
PROCfull_dup(on)
PROCsat_mode(rx,usb): PROCsat_freq(rx,435.916)
PROCsat_mode(tx,fm ): PROCsat_freq(tx,145.850)
PROCcat(off)
END
:
REM Now follows procedures and functions
:
DEF PROCcat(F%)
IF F%=on B%(5)=0 ELSE B%(5)=&80
PROCput: ENDPROC
:
DEF PROCmode(B%(1))
B%(5)=7: PROCput: ENDPROC
:
DEF PROCptt(F%)
IF F%=on B%(5)=8 ELSE B%(5)=&88
PROCput: ENDPROC
:
DEF PROCsplit(F%)
B%(5)=&89: REM simplex
IF F%=plus B%(5)=&49
IF F%=minus B%(5)=9
PROCput: ENDPROC
:
DEF PROCoffset(F)
B%(5)=&F9
PROCfr(F)
PROCput: ENDPROC
:
DEF PROCfull_dup(F%)
IF F%=on B%(5)=&E ELSE B%(5)=&8E
PROCput: ENDPROC


DEF PROCsat_mode(F%,B%(1))
IF F%=tx B%(5)=&27 ELSE B%(5)=&17
PROCput: ENDPROC
:
DEF PROCfreq(F)
B%(5)=1
PROCfr(F)
PROCput: ENDPROC
:
DEF PROCsat_freq(F%,F)
IF F%=tx B%(5)=&2E ELSE B%(5)=&1E
PROCfr(F)
PROCput: ENDPROC
:
DEF PROCfr(F)
IF F>=1000 FX%=on ELSE FX%=off
F=(F+0.000005)/1000
FOR I%=1 TO 4: F=F*100: F%=INT(F): F=F-F%
B%(I%)=(F% DIV 10)*16 + F% MOD 10
NEXT
IF FX%=on B%(1)=B%(1)AND &F + &C0: REM 1200 MHz band
corrrection
ENDPROC
:
DEF FNsqlch
B%(5)=&E7: PROCput: PROCget
IF B%(1)=0 THEN =0 ELSE= -1
:
DEF FNmeter
B%(5)=&F7: PROCput: PROCget
=B%(1)
:
DEF PROCset_up
REM Establish constants etc
DIM B%(5)
off=0: on=-1
rx =0: tx=-1
plus=+1: minus=-1
lsb=0: usb=1: cw=2: cwn=&82: fm=8: fmn=&88
:
REM Most code after this is for controlling the BBC micro
hardware
REM and needs recoding for any other machine.  Note "*FXn,m"
is
REM merely a BBC micro operating system call, no. n, parameter
m.
REM
REM Set up RS423 = 4800,8,N,2
*FX8,6
*FX7,6
*FX156,16,227
ENDPROC
:
DEF PROCput
REM Procedure sends five bytes to RS432c port, spaced by 50ms
REM bytes are in array B%(1) ... B%(5)
FOR I%=1 TO 5
REM Delay below is in the spec, but can actually be omitted 
T%=TIME: REPEAT UNTIL TIME >= T%+5: REM Wait 50 ms/byte
REM Now direct output to RS423, o/p char, and restore o/p to
screen
*FX3,3
VDU B%(I%)
*FX3,0
NEXT
ENDPROC
:
DEF PROCget
REM Flush RS423 I/P buffer, then read bytes from input stream
REM until op code is detected.  Previous value is result.  
REM (straight reading 5 bytes found to be unreliable)
*FX15,1
*FX2,1
REPEAT B%(1)=B%: B%=GET: UNTIL B%=B%(5)
*FX2,0
ENDPROC
:
REM End of code
REM de G3RUH @ GB7SPV 1990 May 29
JAS>