A Remote Controlled HF Communications Receiver via DTMF , Icom IC-R75.
This is something I have always had a desire to do and I did
start the project using the old reliable IC R71 receiver which will
run on 13.8 v DC . The system had to be easy to operate and open access for all
the local hams to use so direct computer control by radio RS232 or
wireless Lan was not a desirable choice, . Since I was not at all sure of the computer connection for
this ICR71 receiver ,I began to experiment with opto couplers across the
frequency and mode controls keypad . The
optocouplers were to be driven by the latched output of a DTMF
decoder . thus I had a scheme to remotely control the receiver on a
solar powered , low HF noise hilltop location , a long way from the
built up area via a 2 m command frequency and listen to the HF
audio output of the receiver on 70cms.
This is the hilltop farm site of our local 2m Linear repeater (
whose audio has to be heard to be believed and sounds just like a simplex
contact ) . The HF noise here at this site is purely atmospheric. We
are so far from any houses there is just no way local man made nearfield
noise contaminates the site . Its a perfect site for an HF receiver .
taken 14 Mar 2008 ! over 5 years ago !
2M Rx ( blue) Zares 70cm Transmitter , Basic
Stamp Inside W2FS Controller ( 70 cms audio
level pot ~ 47K)
I also had in the shack an Icom R75 receiver with the speech
synthesiser option UT 102 installed ,The R75 can be driven
using an external computer control via a two wire system , the rear
of the receiver has a 3.5mm mono jack plug for application of the bidirectional
data and an RS232 interface. The serial data format is 8 bits, no parity, 1 stop bit.The CI-V
connector is a 3.5mm mono phone plug. Shield is ground, tip is signal
and while perving on the net , with great luck I came
across the article by John Hansen W2FS
in QST for May 1998 titled
" An Inexpensive Remote base station Controller Using the
Basic Stamp" http://www.coastalchip.com/ .
This was the answer to my prayer ....dump the R71( which also runs
the single wire CI-V system) receiver project and
press the R75 into operation ! a much more appealing setup!. John had written the software to enable a Basic
Stamp microprocessor to control an Icom 706 HF rig remotely via
DTMF generated on a hand held radio . You must download and Read the
Article, it is very informative The beauty about the Icom
radios is that all the rigs use the almost the same control commands and
what works on a 706 will most probably work on any computer controlled
Icom ...within reason !. So I studied up control codes, commands adresses
etc for icom radios , There is an extremely informative german
website http://plicht.de/ekki/civ/civ-p4301-r75.html
which is a must read for anyone contemplating external control of icom equipment
.
The PC Boards for the W2FS Controller project are available ex stock from "Far Circuits" in USA , http://www.farcircuits.net/ so I ordered 4 pre etched and drilled PC boards at US$6 each ,plus postage down under , and Fred had them here in no time at all. Meanwhile I had ordered the Basic Stanp BS2 itself not cheap @ NZ$ 70 , educational programming kit locally, more $$$ ( which you do not need for this project as you can program the Stamp via your RS232 port on your computer straight into the W2FS remote base PC Board, ) and sourced the DTMF decoder equivalent ZARLINK CT8880 IC from a source "' futurelec'' in Australia . At this stage DO NOT USE ANY OTHER STAMP THAN THE GREEN BS2 vanilla model ... I am also trying a RED BS2e as a replacement and am having nothing but trouble , the same program with the original green BS2 "'vanilla runs perfectly however I have since learned that to get the BS2E to operate correctly with the ICR75 you must change the BS2e serial ports to OPEN DRAIN MODE or it will give you trouble thanks David Carrier of parallax ... he says "
" I read up on the CI-V bus from the link you provided, and it looks like the program you give is driving the bus high, when it should be set in open drain mode. Try adding 32768 to the baud rate and see how the program behaves. ""
Dear Mike,
Serial transmissions on the BS2, and many other devices,
default to a push-pull output (see: http://en.wikipedia.org/wiki/Push–pull_output)
where it uses transistors to connect the data line to either power or ground,
depending on whether it is outputting a high or low signal. This only
allows one device on a bus to output data, but it does allow for higher
transmission rates.
The CI-V bus has relatively low transmission rates and may
have multiple devices on it that output data, so it instead uses an
open-collector output. (see:http://en.wikipedia.org/wiki/Open_collector)
It only has a transistor to drive the line to ground, and it depends on a
resistor to pull the line to power when no devices are driving it to ground.
This prevents issues when multiple devices try to drive the line at the same
time. Adding 32768 to the baud rate sets the BS2 and BS2e to use
open-collector outputs instead of push-pull outputs.
The microcontroller in the standard BS2 has less powerful
output transistors than the microcontroller in the BS2e, so that may be why the
BS2 still worked on the CI-V bus while using push-pull outputs even though it
should not have worked.
thanks David for baling me out over this .. wonderful !!
' While waiting for all these parts I downloaded the Zipped Stamp Basic control program from the "net " source http://www.arrl.org/files/qst-binaries/ and studied it as closely as I could . also downloading the free programming software from the Parallax website . http://www.parallax.com/tabid/441/Default.aspx I know there are many of you who could have used a $2 pic but i know didley squatt about programming ! happy to send you an email copy of the software I modified .. and used
When the parts were all here I assembled the pcboard connected all the audio
in , out cables, required plugs switches sockets etc , The
Stamp BS2 will talk directly to the programming PC !! I
plugged the dtmf controller board into the computer RS232 port via a
ribbon connected DB9 ,I connected to a female DB9 as follows:
Pin1 stamp to 2 DB9, pin 2 stamp to pin 3 DB9 pin3 stamp
to pin 4 DB9 and pin 4 stamp to pin5 DB9 Gnd ,
Switched the controller
on and loaded the 706 controller software into the Stamp BS2 using the
free downloaded parallax stamp editor . Connected it
all up to the 2m radio, vol up over half setting (on the command frequency) 70 cms radio (
my monitored HF audio output ), IC-706 3.5 mm
bidirectional data connection and them tried
different commands as described in the QST Article , Bingo it
worked on the IC 706
Using the "set menu" function of the R75, I Changed
the CIV internal address on the R75 to 48 hex. set the R75
baud rate to "'auto"" made sure CIV trans was
set "'on' , CIV 731 to ''óff''' swapped the
data cable over to the '3.5mm plug bidirectional remote data port on the
back of the R75 next to the RS232 connector and
bingo that worked as well ....jackpot!!
We now have the makings of a handheld controlled remote HF
receiver ( the 706 may have been a more versitile unit to place up
the hill as it has wide receive/transmit frequency coverage ), however the site is
power limited solar site and the 706 has a couple of undesirable features , like high
standing receive current (just over 1 amp) and it would require modification to
remotely turn it on and off. Also we dont need to transmit from there as that can be
done from home where electrical supply is not so limited ,and ambient local noise
is not a concern,
DECIMAL
VALUE
|
BINARY
VALUE
|
KEYBOARD
SYMBOL
|
0
|
0000
|
D
|
1
|
0001
|
1
|
2
|
0010
|
2
|
3
|
0011
|
3
|
4
|
0100
|
4
|
5
|
0101
|
5
|
6
|
0110
|
6
|
7
|
0111
|
7
|
8
|
1000
|
8
|
9
|
1001
|
9
|
10
|
1010
|
0
|
11
|
1011
|
*
|
12
|
1100
|
#
|
13
|
1101
|
A
|
14
|
1110
|
B
|
15
|
1111
|
C
|
DTMF,decimal ,binary code equivalents taken from www. engineersgarage .com
The original software is written to readout the frequency and modes of the
radio if interogated in CW ,This works well, but Im not a cw man so
I popped the UT 102 speech synthesiser into the R-75 so It
would speak the frequencies when commanded . The last few pages of
the icr 75 manual gives the format of the CI-V commands
and the command and combinations to achieve what you wish the radio to do
.. There was some simple
basic commands added to the existing code to do this I "remed"
out the morse routine and dropped in the line of basic call subroutine ,
to command the speech synthesiser to read out frequency and operation mode
when the morse subrountine was called . When i wanted "' mode'' to be
read out I replaced morse with speech and frequency
'the morse command was replaced by the speech1 command
speech:
SEROUT 8,813,[$FE,$FE,$48,$E0,$13,$00,$FD]
(' to set speech synthesiser to talk)
RETURN
This did all I really wanted to as far as knowing frequency and modes the
receiver was on , however there was another extremely useful piece of
information I found in the Icom command codes ! The operational ic
r75 with the vol turned down draws about 750 mA or so ! so at
our solar site it needs to be turned off when not in use .
The R8500 and R75 radios are the only icom radios that have
a software "on" and "off " function.....
Yahoo!! I dont have to solder an optocoupler across the
"ON-OFF" button to remotely turn the R75 off and on so I delved
into the basic stamp code again and inserted this line ( note the
icom users manual has the on and off sub command codes reversed )
'======================MAIN EVENT LOOP===========================
Gateopen:
HIGH 13
GOTO switch
'======================switch r 75 on ======================================
switch:
SEROUT 8,813, [$FE,$FE,$48,$E0,$18,$01,$FD]
' ( turn radio on
!! )
GOTO main
-----------------------------------------------------------------------------------
"" there is heaps of lines of johns code in between here ""
GOSUB morse
NEXT
RETURN
shutdown:
GOSUB id
SEROUT 8,813,[$FE,$FE,$48,$E0,$18,$00,$FD]
( turn radio off !!)
GOTO gateway
iddrop:
OUT7 = 1
PAUSE 100
OUT7 = 0
PAUSE 100
OUT7 = 1
GOSUB id
GOTO main
the commands below have to be inserted into the code :
speech:
SEROUT 8,813,[$FE,$FE,$48,$E0,$13,$02,$FD] '
to set speech synthesiser to talk "' mode'' used
RETURN
speech1:
SEROUT 8,813,[$FE,$FE,$48,$E0,$13,$00,$FD]
to read ''frequency '' of the display
RETURN
( there are two "modes"of speech command .
speech..... only speakes the mode the radio is in the
other
speech1 command . will speak the frequency and
the mode
(( what i suggest to do before the speech and speech1 command is put a Pause
400 in the program listing so there is a 400 ms delay in
the radio response so any controlling hand held has time to return to
receive on 2m and open the squelch , my vx5 is a bit slow at this
and sometimes misses the first digit the radio speaks when it reads back
the frequency on 2m ))
'=======================ROUTINE TO TRANSMIT MORSE=======================
'This routine is based upon Application Note #8 in the Basic Stamp 1
'manual
------------------------------------------------------------------------------
I also added with simple basic the the ability to turn receive rf preamp one off and on using the No, 3 and No, 6 on the keypad
' ========================== pre amp control================================
preampon:
SEROUT 8,813, [$FE,$FE,$48,$E0,$16,$02,$01,$FD] ' turn preamp on
PAUSE ptime
SEROUT 8,813, [$FE,$FE,$48,$E0,$18,$01,$FD]
HIGH 13
GOTO switch
RETURN
preampoff:
SEROUT 8,813,[$FE,$FE,$48,$E0,$16,$02,$00,$FD] ' turn preamp off
HIGH 13
GOTO switch
PAUSE ptime
'SEROUT 8,813, [$FE,$FE,$48,$E0,$18,$01,$FD]
RETURN
'======================SCANNING======================================
Now I can turn the Receiver off and on remotely ! change frequency,
mode and have it all read back to me ,,,,, all with software !!
I dont have to worry too much about power budget as the
controller unit which draws milliamps , has a time out function> If
you drop dead using the remote HF receiver or your handheld batterries go
flat , it will turn everything off after a user "defined by
software " period of time , go to standby and it works a
treat ,,, have it set for about 30 mins here but you can change it
easily ...
There are some features you can turn off or on and have the radio
speak the parameters as well . if you go to the
'"set-menu "' area and turn on ...sp met .. this
will speak the received S Meter reading and SP
CLK "'on "'. will speak the time on the r75
clock.
Commanding the frequency function will provide the s meter
reading digit , followed by the frequency read out to 100 Hz resolution .
then the time as in the r75 clock . Iif you turn off .. met and clk
... only frequency will be read out . You will probably have to
increase the speech synthesiser audio level by adjusting
R1254 and perhaps lower the value of R1256(47k) otherwise
'"she"' is difficult to hear when the band conditions are noisey
.
ICR-75 as a diversity receiver pair
The Icom single wire control system is quite clever .It is BI-
DIRECTIONAL ( thats got nothing to do with its sexual preferences!!) When
the radio does something ie you turn the frequency knob or change
modes . The radio SENDS these changes out its CV-i
port if you connect two ICR75 receivers together via their CI-V
ports by a simple mono cable terminated in 3.5 mm male plugs at each end,
both set to the same computer address ie $48 . CV-! set to
transceive and the same baud rate , the second R75 will mimic
the exact frequency and mode changes of the one you are tuning and vice
versa This feature only seems to happen with frequency and
Modes as far as I can see from my limited testing. . However i was
thinking that if you had a bidirectional radio uhf link
you could have both radios slaved together in frequency and mode
separated by what ever distance you could get the CI-V data across
.10 -20 miles ?? . that way you could tune about the
band and listen to both radios simultaneously and have control
of frequency and mode of both ?? im sure other Icoms will
exhibit this master slave relationship .. FOOD For Thought
!!
.
Icom R-75 in Repeater shed. Blue unit is 145 Mhz
Receiver, ( later
replaced by a Zares 2m handheld radio ) 70 Cms Tx hand held underneath Amp meter
photo taken Mar 2008
!
Now I am no programmer and the scruffy code i have inserted could no
doubt be tidied up , but it works . You could add all sorts
of commands to this code if you wanted to but you may need the next
"size" basic stamp chip to enable this as you may run out of memory
space. There is probably a lot of morse commands that could be
deleted to obtain more "space" My next project is to learn how to
program the "'multi memory"' BS2e then I can have to r75
do much more for its remote user .
I can now drive
around in the middle of town not worrying about the crap sig to noise of
the mobile HF transceiver as I can talk from my Vehicle to my
friends on HF , and hear them coming back loud and clear via the 70 cm backlink
on 430.0375 MHZ from the
remote HF site and the beauty of
the icom 706 versatility in the vehicle is i can have an HF SSB /
70 cms NMFB split to achieve this !!
What I have found with the system is sometimes the remote command unit must fall over when decoding DTMF multipath , If you find that it is not responding how it should . Try sending a few 5 sec timed spaced "D"commands if it responds with a frequency and mode readout it ready to be commanded again or wait ,a minute or so and the stamp will clear itself and continue on as it should , In five years of use . Ive not had a situation where I could not get in and obtain control..
Looking towards Rotorua city 10Kms
away
Looking out west over lake Rotorua
we are so far from anywhere it takes 30Mins to get there from town with 4WD
Looking north east out to Maketu ( towards sea)
looking East out over lake Tarawera to Mnt Tarawera
Well how well does it go ? after putting up the G5RV antenna mainly because its "ham Multiband " and connecting it to the receiver and listening on 10 m, we can hear the low level background noise eminating from the little Zares 70 cms synthesised down link transceiver ! so thats going to have to be quelled , hopefully a few turns around ferrite toroids with the antenna coax and power supply will help minimize that . ( turns out it was the 12 v to 6V switching power supply and I put all that inside a sealed bypassed rf tight box )
It is just as easy to place a small 1 amp 7806 three terminal regulator mounted on the receive Zares chassis and have a no noise linear voltage regulator instead and put up with a little more power drain , You can only do this trick with the receive only radio as the transmitter, the current will be up around an amp on low power and if you transmitt for a short while the three terminal regulator will heat up the aluminium chassis beyond a safe value and you will damage the transmitting radio .
7805 1 amp reg screwed to cast aluminium back of little
FDC handheld
For the transmitter power supply , I have made a small modified 5 v 1 Amp switch
mode regulator converted to 6.4 Volt in a screened metal box with
feed throughs and multi turn ferrite chokes to keep the RF
noise contained ..Even with the radio running 1 watt out the heatsink will get
hot , these radios are not designed for continuous operation so will need
additonal cooling help a small 12 v fan was the easiest to implement
and provides a quiet gentle breeze at 6.4 v such that the heatsink never
gerts warm !!
What i found is that the small 12 v computer CPU fan generates RF noise on HF !! so you will have to put some bypass caps and small ferrite chokes in the dc leads to the motor and radio, I found passing the downlink transmitter UHF coax through a large ferrite clamp on toroid 4 times, very close to the radio SMA connecter eliminated ''99%'' of it .
Then when the sun comes out full shine and the linear repeaters SLA batteries are fully charged, the solar panel regulator( PWM unit) makes its presence felt by causing a whine on the received audio I think this may be DC power induced as when I switch in the R 75 preamp on 10m , the sig to noise improves but the whine doesnt increase ! , need some good DC filtering me thinks . I think running the Icom on 12-13 v doesnt give the onboard regulators much headroom to "work well" so you need a good well filtered DC supply which I made with some very large electrolytics and a good size DC wirewound choke .
14/6/14 have replaced the BS2 with a
BS2E with
more memory for more features when I learn how to program to
make use of the extra memory and the royal "we" has run into trouble with micro
processor noise being picked up by the HF antenna . the BS2E
chip runs at 20 Mhz , much faster than the old BS2, draws
more current and it kicks up more RFi . In an attempt to beat this
problem I have placed the pc board in a tin can with 820nF feed throughs
on all connections . and rf chokes on all the coaxs leaving the
HF module 70 cms and 2 m antenna also HF coax ,
but the noise is still there .less, but still there , ill have to
attack this problem sequentially . it is mainly a problem at 3 Mhz
area , I would love to see it gone !
19/7/14 Since then I have tackeled this micro noise problem and found the
solution . I have placed ferrite chokes in both sides of the output
connections of most pins that connect the BS2E to the outside world
. I found the chokes in the earth side of the audio connections had
a large effect .After much experimenting with different
toroids
to get as large an inductance as possible. I discovered the humble ferrite bead
would provide the greatest inductance for volume ratio than any torroid I
had .. 12 passes of fine enamelled wire through a ferrite bead
would give typically 150 plus uH according to my Agilent hand held
inductance meter . Perfect for what I want and very small as
well to fit into small places . so I soldered them to all the standoffs on
the pc board and connected them to the output feed-throughs and the
micro noise is no longer a problem .. happy happy happy joy joy joy
!
Micro controller board with ferrite beads in place
The remote receiver shares the same bench space as our local 2m linear two
meter repeater . which transmitts on 144.350 MHz and receives on
144.950 MHz. The 145 MHz Remote receiver also shares the same 2* 5/8 receive co-linear
antenna that the repeater uses by using a minicircuits rf
splitter at the output of the the two large 10"inch sinclair
coaxial filters (4 inch ones were replaced) and we just accept the measured 3.6 dB loss
the splitter incurs at the repeater input .
The pass band of the filters is such that 145 Mhz can
just sneak through above 144.950 peak, with minimal attenuation as well
,
thus we get
1. The benefit of the higher gain co-linear 2m receive antenna
and
2. The benefit of the repeater receive filters transmit rejection notch
,.this notch eliminating the high power 144.350 transmit signal and
its potential de sensed of the remote control 145 MHz
receiver . Thus enabling contemporaneous
use of both systems .
2 m Linear repeater receive filter response ,,,,, see where 145 MHz is !
. You do however notice the improved signal when compare to my almost
identical home set up ( G5RV and R-75 Rx ) on the same signals , my
background semi rural location still has a higher local background noise so
very weak signals , readable on the remote site are almost uncopyable on
the home set up . Well at least the guys in town with
their very high local noise level on 80 and 40 m will still be able
to work some good DX !!
The next idea is a one way ( thats all we need) 300 baud data link so any one with an icom synthesised HF transceiver can remotely ( slave) tune" the remote R75 ön the fly"using control CI-V data sent from their own icom transceiver änd listen on the tuned signal on 430.0375 MHz nbfm downlink ..
I guess the next project is to hook it up to the internet ??
The original source code is a ZIP File (706stamp.zip) and is at http://www.arrl.org/files/qst-binaries/ scroll down near the bottom to find MAY 1998
Il find out how I can attach the total pbasic code here and you can download the complete R 75 basic stamp code off my site ..
Cheers Mike ZL1BTB
This project has now been sponsered by NZART Branch 33 Rotorua NZ, as our club HF remote receiver , it is open for all hams to use.
The Software listing text .... SET FOR 300 BAUD 8N1 so set your r75 to 300 baud !! 48Hex
' {$STAMP BS2} ' {$PBASIC 2.0} 'This code is copyright (c) 1997, John A. Hansen, W2FS, all 'rights reserved. It may be used by individual amateur radio 'operators to construct their own interfaces for noncommercial 'purposes without royalty or fee. Commercial users should 'contact the author at hansen@fredonia.edu 'AT A MINIMUM YOU MUST CHANGE THE CALLSIGN IN THIS PROGRAM 'TO YOURS! ''Software code to enable use on ICR75 Copyright MAPinfold ZL1BTB all 'rights reserved. It may be used by individual amateur radio 'operators to construct their own interfaces for noncommercial 'purposes without royalty or fee. '' 'variables to control 8880 chip RS CON 4 ' Register-select pin (0=data). RW CON 5 ' Read/Write pin (0=write). CS CON 6 ' Chip-select pin (0=active). dtmf VAR Byte ' Received DTMF digit. dt_Flag VAR Bit ' DTMF-received flag. dt_det VAR INL.BIT2 ' DTMF detected status bit. 'Remote Base Variables polls VAR Word ' Number of unsuccessful polls of DTMF. xmitc VAR Byte ' counter for watchdog xmit on HF linkc VAR Byte ' counter for watchdog xmit on Link ib VAR Byte(10) Character VAR Byte Elements VAR Nib i VAR Nib j VAR Nib freqlen VAR Nib declen VAR Nib decpos VAR Nib inKhz VAR Bit cancel VAR Bit padl VAR Nib freqdig VAR Nib(3) fstep VAR Nib 'Constants Pw1 CON 4 'first password digit pw2 CON 8 'second password digit ' In this sample, the password is set to 48. call_length CON 6 'the number of characters 'in your callsign, e.g. ZL1rot = 6 Ptime CON 1200 Period CON 43 Tone CON 1200 'transmit cw at 1200 Hz. Quiet CON 0 Dit_length CON 60 'increase these two items proportionately Dah_length CON 240 'to slow down the morse code speed. '==========================SET UP CODE============================= 'The next 8 lines of code were provided by Scott Edwards Electronics 'in the 8880 AppKit. OUTL = %01111111 ' pins 0-6 high DIRL = %01111111 ' pins 0-6 outputs OUTL = %00011000 ' Clear register A HIGH CS OUTL = %00010000 ' Clear register B HIGH CS 'Deactivate CM8880 HIGH RW ' And set RW to "read." DIRL = %11110000 ' Now set the 4-bit bus to input. DIRH = %01100010 ' control outputs to transistor switches '========================CHECK PASSWORD=========================== Gateway: linkc = 0 LOW 13 fstep = 3 GOSUB DetectTone IF dtmf = pw1 THEN tonetwo 'first tone received correctly. GOTO Gateway tonetwo: GOSUB DetectTone IF dtmf = pw2 THEN Gateopen 'second tone received correctly GOTO Gateway '======================MAIN EVENT LOOP=========================== Gateopen: HIGH 13 GOTO switch '======================switch r 75 on ====================================== switch: dtmf =17 NOTE open drain mode ..32768 added to numerical value to get baud rate SEROUT 8,36081, [$FE,$FE,$48,$E0,$18,$01,$FD] ' turn radio on at 300 baud PAUSE 1800 GOSUB speech '' THEN tells user last freq AND mode used ' GOTO main shutdown: GOSUB id SEROUT 8,36081,[$FE,$FE,$48,$E0,$18,$00,$FD] ' turns R 75 off) GOTO gateway Main: IF IN12 = 0 THEN iddrop 'if its time to ID, do it. GOSUB readfreq nodata: dtmf = 17 GOSUB DetectTone 'look for dtmf tone IF dtmf = 12 THEN SendFreq 'Send the whole freq in morse IF dtmf = 6 THEN preampoff 'turn preamp 1 off IF dtmf = 3 THEN preampon 'turn preamp 1 on IF dtmf = 0 THEN SetFreq 'Set the whole frequency from dtmf input IF dtmf = 2 THEN upfreq 'freq up by 1 step IF dtmf = 1 THEN downfreq 'freq down by 1 step IF dtmf = 10 THEN readmode 'Find out what mode the radio is in IF dtmf = 8 THEN changemode 'Change the Radio's mode IF dtmf = 5 THEN ptt 'Key or unkey the PTT line IF dtmf = 4 THEN shutdown 'Shut down IF dtmf = 7 THEN IDit 'Force CW ID on VHF channel linkc = linkc +1 IF linkc > 240 THEN shutdown 'watchdog timer on link is about 20 minutes changed from 240 is 20 min approx GOTO Main '===================ROUTINES TO CONTROL DTMF XCVR=================== DetectTone: polls = 0 top: HIGH RS ' Read status register. LOW CS ' Activate the 8880. dt_flag = dt_det ' Store DTMF-detected bit into flag. HIGH CS ' End the read. IF dt_Flag = 1 THEN ReadTone ' If tone detected, do ReadTone polls = polls + 1 IF polls < 5000 THEN top back: RETURN ReadTone: ' Tone detected: LOW RS ' Get the DTMF data. LOW CS ' Activate 8880. dtmf = INL & %00001111 ' Strip off upper 4 bits using AND. HIGH CS ' Deactivate 8880. linkc = 0 GOTO back: ' Return to DetectTone idit: 'forces a CW ID GOSUB id GOTO main '====================READ CURRENT FREQUENCY=================== ReadFreq: SEROUT 8,36081,[$FE,$FE,$48,$E0,$03,$FD] 'Request the Freq from the Radio ( cmged to $04 was $03 ??????) SERIN 8,36081,100,nofreq,[ib(0),ib(0),ib(0),ib(0),ib(0),ib(5),ib(4),ib(3),ib(2),ib(1)] '(Read the freq to IB FOR i = 1 TO 9 STEP 2 ib.LOWNIB(i) = ib.LOWNIB(i+2) 'handles reversing nibbles NEXT RETURN nofreq GOTO nodata RETURN SendFreq: 'Sends entire freq in morse including . GOSUB ReadFreq PAUSE ptime GOSUB speech ' was morse GOTO Main '====================SET FREQUENCY ON RADIO============================= SetFreq: 'Set Entire frequency FOR j = 0 TO 4 'Clear the values of ib ib(j) = 0 NEXT decpos = 0 'Is the position of the decimal point declen = 0 'Is the number of digits to right of decimal freqlen = 0 'Is the total number of digits in the frequency GOSUB gather 'Go get the digits in the frequency FOR j = 0 TO (freqlen) 'This loop figures out where the decimal is. IF ib.LOWNIB(j) < 10 THEN nodec declen = freqlen-j decpos = j nodec: NEXT IF declen > 0 THEN dontadd ' If there is no decimal then add 1 to freqlen freqlen = freqlen +1 dontadd: inKhz = 1 'Assume freq is in Khz IF freqlen -declen > 3 THEN notMhz 'If there are more than 3 digits to left of decimal it is in khz IF (ib.LOWNIB(0) > 1) AND (freqlen-declen =3) THEN notMhz 'If there are 3 digits to the left of decimal and 1st is more than 2 it is Khz inKhz = 0 ' Otherwise it is in Mhz notMhz: IF decpos = 0 THEN skipdec 'This set of statements eliminates the decimal point FOR i = decpos TO (freqlen -1) ib.LOWNIB(i) = ib.LOWNIB(i+1) NEXT ib.LOWNIB(freqlen) = 0 skipdec: padl = ((inKhz*3)+3) +1 - (freqlen-declen) MIN 1 'calculates the number of 0's to put on the left. FOR i = (freqlen - 1) TO 0 ib.LOWNIB(i+padl) = ib.LOWNIB(i) 'Shift the digits to the right to their correct positions. NEXT FOR i = 0 TO (padl-1) ib.LOWNIB(i) = 0 'add the zeros on the left where you shifted. NEXT GOSUB setradfreq GOTO Main 'go back to main menu gather: GOSUB DetectTone 'get a dtmf tone IF dtmf = 0 THEN back1 'if an "d" then you are done GOSUB tentozero 'convert the digit "10" to a "0" ib.LOWNIB(freqlen) = dtmf.LOWNIB IF freqlen > 10 THEN back1 'If you've received ten digits quit freqlen = freqlen+1 GOTO gather back1: freqlen = freqlen-1 MAX 10 'In case of error. RETURN SetSubFreq: ib.LOWNIB(0) = 0 FOR i = 1 TO 10 ib.LOWNIB(i-1) = ib.LOWNIB(i) NEXT ib.LOWNIB(0) = 0 GOSUB gather2 padl = (10-decpos) FOR i = 0 TO 2 ib.LOWNIB(padl+i) = freqdig(i) NEXT GOSUB setradfreq GOTO main setradfreq: GOSUB reversenib SEROUT 8,36081,[$FE,$FE,$48,$E0,$07,$FD] SEROUT 8,36081,[$FE,$FE,$48,$E0,$05,ib(4),ib(3),ib(2),ib(1),ib(0),$FD] 'set the frequency on the radio GOSUB speech ' speak frequency RETURN gather2: GOSUB DetectTone decpos = dtmf.LOWNIB '3=hz, 6=khz, 9= Mhz FOR j = 0 TO 2 GOSUB DetectTone GOSUB tentozero freqdig(j) = dtmf.LOWNIB NEXT RETURN reversenib: FOR i = 0 TO 4 j = ib.LOWNIB(2*i+1) ib.LOWNIB(2*i+1) = ib.LOWNIB(2*i) 'reverse the nibbles for transmission to radio ib.LOWNIB(2*i) = j NEXT RETURN ' ========================== pre amp control================================ preampon: SEROUT 8,36081, [$FE,$FE,$48,$E0,$16,$02,$01,$FD] ' turn preamp on GOTO main preampoff: SEROUT 8,36081,[$FE,$FE,$48,$E0,$16,$02,$00,$FD] ' turn preamp off GOTO main upfreq: GOSUB ReadFreq FOR i = 0 TO 10 ib.LOWNIB(i) = ib.LOWNIB(i+1) ' shift 1 digit (for leading 0) NEXT ib.LOWNIB(10-fstep) = ib.LOWNIB(10-fstep)+1 'add one step to freq FOR i = (10-fstep) TO 3 'adjustment for rollover of 9s IF ib.LOWNIB(i) > 9 THEN adjust GOTO continue adjust: ib.LOWNIB(i) = 0 ib.LOWNIB(i-1) = ib.LOWNIB(i-1) + 1 continue: NEXT GOSUB reversenib GOSUB putfreq 'put freq GOTO main downfreq: GOSUB ReadFreq FOR i = 0 TO 10 ib.LOWNIB(i) = ib.LOWNIB(i+1) ' shift 1 digit (for leading 0) NEXT j = 10-fstep ib.LOWNIB(j) = ib.LOWNIB(j)-1 'add one step to freq FOR i = (j) TO 1 'adjustment for rollover of 9s IF ib.LOWNIB(i) > 9 THEN adjust1 GOTO continue1 adjust1: ib.LOWNIB(i) = 9 ib.LOWNIB(i-1) = ib.LOWNIB(i-1) - 1 continue1: NEXT GOSUB reversenib GOSUB putfreq GOTO main putfreq: SEROUT 8,36081,[$FE,$FE,$48,$E0,$05,ib(4),ib(3),ib(2),ib(1),ib(0),$FD] 'set the frequency on the radio RETURN changestep: GOSUB DetectTone fstep = dtmf GOSUB roger GOTO main '======================ROUTINES TO EXAMINE/ADJUST MODE================= ReadMode: SEROUT 8,36081,[$FE,$FE,$48,$13,$02,$FD] 'will look up comand to read mode' GOSUB speech1 ' speakes mode only' GOTO main Changemode: GOSUB getmode PAUSE 50 IF ib(0) = 2 THEN dofive IF ib(0) = 5 THEN dozero ib(0) = ib(0) +1 PAUSE 50 GOTO thatsall dofive: ib(0) = 5 GOTO thatsall dozero: ib(0) = 0 thatsall: PAUSE 150 SEROUT 8,36081,[$FE,$FE,$48,$E0,$06,ib(0),$FD] 'cycles to the next mode PAUSE 25 GOTO ReadMode getmode: SEROUT 8,36081,[$FE,$FE,$48,$E0,$04,$FD] PAUSE 5 SERIN 8,3313,[ib(0),ib(0),ib(0),ib(0),ib(0),ib(0)] 'Read the mode to ib(0) RETURN roger: PAUSE ptime character =67 GOSUB speech 'transmit an "r" speak RETURN tentozero: IF dtmf <> 10 THEN fixten dtmf = 0 'Change a received "10" to a "0" fixten: RETURN ptt: xmitc = 0 TOGGLE 13 'toggle ptt on link TOGGLE 14 'toggle ptt on HF dtmf = 17 doit2: GOSUB DetectTone xmitc = xmitc + 1 IF xmitc >240 THEN unkey 'watchdog timer on HF is 30 minutes each "1" is 26 sec. 8=94 sec ?? IF dtmf < 17 THEN unkey 'If any tone is heard GOTO doit2 unkey: LOW 14 HIGH 13 GOTO main id: PAUSE ptime FOR i = 0 TO (call_length - 1) LOOKUP i,[196,68,125,67,227,129],character 'ZL1ROT see table at the end of this 'program to get these values. GOSUB morse NEXT RETURN iddrop: OUT7 = 1 PAUSE 100 ' triggers 555 OUT7 = 0 PAUSE 100 OUT7 = 1 GOSUB id GOTO main '=========================================' to set speech synthesiser to talk =============================== speech: ' speakes freq only' PAUSE 400 SEROUT 8,36081,[$FE,$FE,$48,$E0,$13,$00,$FD] RETURN speech1: ' speakes mode only' PAUSE 400 SEROUT 8,36081,[$FE,$FE,$48,$E0,$13,$02,$FD] RETURN '=======================ROUTINE TO TRANSMIT MORSE======================= 'This routine is based upon Application Note #8 in the Basic Stamp 1 'manual Morse: 'routine to transmit morse Elements = Character & %00000111 'See basic stamp I application IF Elements < 6 THEN Bang_Key '#8 elements = 6 Bang_Key: FOR j = 1 TO Elements IF Character >= 128 THEN Dah GOTO Dit Reenter: Character = Character * 2 NEXT GOSUB char_sp RETURN Dit: FREQOUT 9,Dit_length,tone FREQOUT 9,Dit_length,Quiet GOTO Reenter Dah: FREQOUT 9,Dah_length,tone FREQOUT 9,Dit_length,Quiet GOTO Reenter Char_sp: FREQOUT 9,Dah_length,Quiet PAUSE 300 ' testing RETURN '===================END================================================ ' ' ' Callsign Letter/Number Values ' 'A 66 M 194 Y 180 'B 132 N 130 Z 196 'C 164 O 227 0 253 'D 131 P 100 1 125 'E 1 Q 212 2 61 slash bar = 149 'F 36 R 67 3 29 'G 195 S 3 4 13 'H 4 T 129 5 5 'I 2 U 35 6 133 'J 116 V 20 7 197 'K 163 W 99 8 229 'L 68 X 148 9 245
'====================SET FREQUENCY ON RADIO=============================
SetFreq: 'Set Entire frequency FOR j = 0 TO 4 'Clear the values of ib ib(j) = 0 NEXT decpos = 0 'Is the position of the decimal point declen = 0 'Is the number of digits to right of decimal freqlen = 0 'Is the total number of digits in the frequency GOSUB gather 'Go get the digits in the frequency FOR j = 0 TO (freqlen) 'This loop figures out where the decimal is. IF ib.LOWNIB(j) < 10 THEN nodec declen = freqlen-j decpos = j nodec: NEXT IF declen > 0 THEN dontadd ' If there is no decimal then add 1 to freqlen freqlen = freqlen +1 dontadd: inKhz = 1 'Assume freq is in Khz IF freqlen -declen > 3 THEN notMhz 'If there are more than 3 digits to left of decimal it is in khz IF (ib.LOWNIB(0) > 1) AND (freqlen-declen =3) THEN notMhz 'If there are 3 digits to the left of decimal and 1st is more than 2 it is Khz inKhz = 0 ' Otherwise it is in Mhz
notMhz:
IF decpos = 0 THEN skipdec 'This set of statements eliminates the decimal point FOR i = decpos TO (freqlen -1) ib.LOWNIB(i) = ib.LOWNIB(i+1) NEXT ib.LOWNIB(freqlen) = 0 skipdec:
padl = ((inKhz*3)+3) +1 - (freqlen-declen) MIN 1 'calculates the number of 0's to put on the left. FOR i = (freqlen - 1) TO 0 ib.LOWNIB(i+padl) = ib.LOWNIB(i) 'Shift the digits to the right to their correct positions. NEXT FOR i = 0 TO (padl-1) ib.LOWNIB(i) = 0 'add the zeros on the left where you shifted. NEXT GOSUB setradfreq GOTO Main 'go back to main menu
gather: GOSUB DetectTone 'get a dtmf tone IF dtmf = 0 THEN back1 'if an "d" then you are done GOSUB tentozero 'convert the digit "10" to a "0" ib.LOWNIB(freqlen) = dtmf.LOWNIB IF freqlen > 10 THEN back1 'If you've received ten digits quit freqlen = freqlen+1 GOTO gather back1: freqlen = freqlen-1 MAX 10 'In case of error. RETURN
SetSubFreq: ib.LOWNIB(0) = 0 FOR i = 1 TO 10 ib.LOWNIB(i-1) = ib.LOWNIB(i) NEXT ib.LOWNIB(0) = 0 GOSUB gather2 padl = (10-decpos) FOR i = 0 TO 2 ib.LOWNIB(padl+i) = freqdig(i) NEXT GOSUB setradfreq GOTO main
setradfreq:
GOSUB reversenib SEROUT 8,813,[$FE,$FE,$48,$E0,$07,$FD] SEROUT 8,813,[$FE,$FE,$48,$E0,$05,ib(4),ib(3),ib(2),ib(1),ib(0),$FD] 'set the frequency on the radio GOSUB speech ' speak frequency RETURN
gather2: GOSUB DetectTone decpos = dtmf.LOWNIB '3=hz, 6=khz, 9= Mhz FOR j = 0 TO 2 GOSUB DetectTone GOSUB tentozero freqdig(j) = dtmf.LOWNIB NEXT RETURN
reversenib:
FOR i = 0 TO 4 j = ib.LOWNIB(2*i+1) ib.LOWNIB(2*i+1) = ib.LOWNIB(2*i) 'reverse the nibbles for transmission to radio ib.LOWNIB(2*i) = j NEXT RETURN ' ========================== pre amp control================================ preampon: SEROUT 8,813, [$FE,$FE,$48,$E0,$16,$02,$01,$FD] ' turn preamp on
'SEROUT 8,813, [$FE,$FE,$48,$E0,$18,$01,$FD] ' what is this ??? ' HIGH 13 ' GOTO switch ' RETURN
preampoff: SEROUT 8,813,[$FE,$FE,$48,$E0,$16,$02,$00,$FD] ' turn preamp off
GOTO main '======================SCANNING====================================== 'scan:
'dtmf =17 remove dtmf ' SEROUT 8,813, [$FE,$FE,$48,$E0,$0E,$01,$FD] 'Start Scanning ' doit: ' GOSUB DetectTone ' IF dtmf < 17 THEN stopscan 'If any tone is heard ' GOTO doit ' stopscan: ' SEROUT 8,813,[$FE,$FE,$48,$E0,$0E,$00,$FD] 'Stop Scanning
'=======================ROUTINE TO STEP FREQUENCY===================== upfreq: GOSUB ReadFreq FOR i = 0 TO 10 ib.LOWNIB(i) = ib.LOWNIB(i+1) ' shift 1 digit (for leading 0) NEXT ib.LOWNIB(10-fstep) = ib.LOWNIB(10-fstep)+1 'add one step to freq FOR i = (10-fstep) TO 3 'adjustment for rollover of 9s IF ib.LOWNIB(i) > 9 THEN adjust GOTO continue adjust: ib.LOWNIB(i) = 0 ib.LOWNIB(i-1) = ib.LOWNIB(i-1) + 1 continue: NEXT GOSUB reversenib GOSUB putfreq 'put freq GOTO main
downfreq: GOSUB ReadFreq FOR i = 0 TO 10 ib.LOWNIB(i) = ib.LOWNIB(i+1) ' shift 1 digit (for leading 0) NEXT j = 10-fstep ib.LOWNIB(j) = ib.LOWNIB(j)-1 'add one step to freq FOR i = (j) TO 1 'adjustment for rollover of 9s IF ib.LOWNIB(i) > 9 THEN adjust1 GOTO continue1 adjust1: ib.LOWNIB(i) = 9 ib.LOWNIB(i-1) = ib.LOWNIB(i-1) - 1 continue1: NEXT GOSUB reversenib GOSUB putfreq GOTO main
putfreq: SEROUT 8,813,[$FE,$FE,$48,$E0,$05,ib(4),ib(3),ib(2),ib(1),ib(0),$FD] 'set the frequency on the radio RETURN
changestep:
GOSUB DetectTone fstep = dtmf GOSUB roger GOTO main
'======================ROUTINES TO EXAMINE/ADJUST MODE================= ReadMode: GOSUB getmode PAUSE ptime IF ib(0)= 0 THEN lsb IF ib(0) = 1 THEN usb IF ib(0) = 2 THEN am IF ib(0) = 5 THEN fm lsb: FOR i = 0 TO 2 LOOKUP i,[68,3,132],character SEROUT 8,813,[$FE,$FE,$48,$13,$02,$FD] 'will look up comand to read mode' GOSUB speech1 ' speakes mode only' NEXT GOTO main usb: FOR i = 0 TO 2 LOOKUP i,[35,3,132],character
GOSUB speech1 ' speakes mode only' NEXT GOTO main am: FOR i = 0 TO 1 LOOKUP i,[66,194],character GOSUB speech1 ' speakes mode only' NEXT GOTO main fm: FOR i = 0 TO 1 LOOKUP i,[36,194],character GOSUB speech1 ' speakes mode only' NEXT GOTO main
Changemode: GOSUB getmode IF ib(0) = 2 THEN dofive IF ib(0) = 5 THEN dozero ib(0) = ib(0) +1 GOTO thatsall dofive: ib(0) = 5 GOTO thatsall dozero: ib(0) = 0 thatsall: PAUSE 50 SEROUT 8,813,[$FE,$FE,$48,$E0,$06,ib(0),$FD] 'cycles to the next mode GOTO ReadMode
getmode:
SEROUT 8,813,[$FE,$FE,$48,$E0,$04,$FD] SERIN 8,813,[ib(0),ib(0),ib(0),ib(0),ib(0),ib(0)] 'Read the mode to ib(0) RETURN
'=======================MEMORY OPERATIONS============================== 'setmemory: ' GOSUB DetectTone ' GOSUB tentozero ' ib.LOWNIB(1) = dtmf ' GOSUB DetectTone ' GOSUB tentozero ' ib.LOWNIB(0) = dtmf ' SEROUT 8,813,[$FE,$FE,$48,$E0,$08,ib(0),$FD] ' SEROUT 8,813,[$FE,$FE,$48,$E0,$08,$FD] ' PAUSE ptime ' character = 194 ' GOSUB speech ' LOOKUP ib.LOWNIB(1),[253,125,61,29,13,5,133,197,229,245],Character ' GOSUB speech ' LOOKUP ib.LOWNIB(0),[253,125,61,29,13,5,133,197,229,245],Character GOSUB morse
'GOTO main '=====================UTILITY ROUTINES================================= roger: PAUSE ptime character =67 GOSUB speech 'transmit an "r" speak RETURN
tentozero: IF dtmf <> 10 THEN fixten dtmf = 0 'Change a received "10" to a "0" fixten: RETURN
ptt: xmitc = 0 TOGGLE 13 'toggle ptt on link TOGGLE 14 'toggle ptt on HF dtmf = 17 doit2: GOSUB DetectTone xmitc = xmitc + 1 IF xmitc >240 THEN unkey 'watchdog timer on HF is 30 minutes each "1" is 26 sec. 8=94 sec ?? IF dtmf < 17 THEN unkey 'If any tone is heard GOTO doit2 unkey: LOW 14 HIGH 13
GOTO main
id: PAUSE ptime FOR i = 0 TO (call_length - 1) LOOKUP i,[196,68,125,67,227,129],character 'ZL1ROT see table at the end of this 'program to get these values. GOSUB morse NEXT RETURN
iddrop: OUT7 = 1 PAUSE 100 ' triggers 555 OUT7 = 0 PAUSE 100 OUT7 = 1 GOSUB id GOTO main '=========================================' to set speech synthesiser to talk =============================== speech: ' speakes freq only' pause 400 ''wait for 2m receiver to open mute
SEROUT 8,813,[$FE,$FE,$48,$E0,$13,$00,$FD] RETURN speech1: ' speakes mode only' pause 400 ''wait for 2m receiver to open mute SEROUT 8,813,[$FE,$FE,$48,$E0,$13,$02,$FD] RETURN
'=======================ROUTINE TO TRANSMIT MORSE======================= 'This routine is based upon Application Note #8 in the Basic Stamp 1 'manual
Morse: 'routine to transmit morse Elements = Character & %00000111 'See basic stamp I application IF Elements < 6 THEN Bang_Key '#8 elements = 6 Bang_Key: FOR j = 1 TO Elements IF Character >= 128 THEN Dah GOTO Dit Reenter: Character = Character * 2 NEXT GOSUB char_sp RETURN Dit: FREQOUT 9,Dit_length,tone FREQOUT 9,Dit_length,Quiet GOTO Reenter
Dah: FREQOUT 9,Dah_length,tone FREQOUT 9,Dit_length,Quiet GOTO Reenter
Char_sp: FREQOUT 9,Dah_length,Quiet
PAUSE 300 ' testing RETURN '===================END================================================ ' ' ' Callsign Letter/Number Values ' 'A 66 M 194 Y 180 'B 132 N 130 Z 196 'C 164 O 227 0 253 'D 131 P 100 1 125 'E 1 Q 212 2 61 slash bar = 149 'F 36 R 67 3 29 'G 195 S 3 4 13 'H 4 T 129 5 5 'I 2 U 35 6 133 'J 116 V 20 7 197 'K 163 W 99 8 229 'L 68 X 148 9 245