'pcrd' Icom PCR-1000 Control Software for Linux / *NIX
Author: Carl D. Walker

'PCRD' PCR-1000 Control Daemon / Command Line interface
for Linux, Solaris, FreeBSD (and other *NIX systems)

Updated 06-29-99 -- Release Version to 0.10

What is PCRD? Well, it is a command line program, that also supports a daemon mode, for controlling an Icom PCR-1000 Wide Band Receiver connected to a system running Linux, Solaris(TM), FreeBSD, or just about any other flavor of *NIX system, that has a serial RS-232 port.

Where is the source code? Here.

Where did it come from? It is an outgrowth of the work done by sili@l0pht.com, on a program called 'pcr.c'. Please note that I have not been in contact with the author of the original program, and it is my hope that he will not be too annoyed that I have taken his code and mutated it into another version. I wanted to take the basic control program that he had written, and add more functionality. This started simply enough by adding support for Squelch, IF Shift, and other functions. I kept going down this road for a little while, and then I ended up with this cut, Version 0.10.

Does it work? The simple answer is 'yes'. I am using this program now to control my PCR-1000, which is located in the basement of my house, near the location where the antenna feedline enters my house. 'pcrd' works, and does not crash either of the two Linux boxes I have used it with, nor does it have problems on my Ultra-1 at work, or my Sparc IPX here at home. :-) I do my best to never release anything that is downright broken. However, there still are what I consider to be some rough spots. I am releasing this now in the hopes of getting some feedback from the PCR-1000 / *NIX users out there, so that I may be better informed as I refine the requirements and changes to this first cut of the program. Please feel free to e-mail any thoughts that you may have for improvements to pcrd@icmp.com .

Are there any bugs? There could be. If there are, please feel free to drop me an e-mail at pcrd@icmp.com and I'll have a look at any problems you may encounter. Please note that this is a very early release, and there are some sections (if not most of the program) that I have plans to re-write, and clean up. This was one of those projects where more functions kept getting added as time went on, and some (or many) parts of it are not nearly as clean as I would like. That being said, I am using this program now to control my radio on a full time basis, and if I find anything in the way of bugs, I will fix it as soon as I come across it.

Are there any precautions that I should know about? There are a couple of them. First, BACK UP YOUR PCR-1000 EEPROM! There are many programs to do this with, mostly under Windows and DOS. Please see thePCR-1000 Resource Page for links to those EEPROM backup programs.

The second precaution is that I DO NOT have full error checking in the code for every bad command that you could possibly send at the thing, so beware. I'll add this as the program gets cleaned up, and grows more. I don't think that you can do anything with this program to damage your radio, but I will certainly NOT be held responsible if you do manage to find a way to do it. Again, BACK UP THAT EEPROM! I should note that during development of the program, I have sent many unintentional things to the radio, and have not had any problems.

What radio functions does it control? It controls most of the every day functions of the radio, but does not include support for the optional DSP unit. I don't have one of the DSP units myself, so I did not bother to develop any code to control it. It does not, in itself, support using the radio in a scanning mode. That is one of the things that I plan to add in the near future. I would like that functionality myself, so it will happen :-)

How do you control the operation of the radio? There are two methods that can be used with pcrd. The first is to use the program from the command line of the system that the radio is connected to. This will set up the radio with the command that you wish to send, and then exit. This first method is much the same in operation as the original pcr.c program, with some added functionality. The second method is to invoke pcrd with the Daemon Mode option (-b, for 'background') enabled. This will cause the program to become a daemon on the system, and disconnect from the terminal session that you started it from. While the program is running in the background mode, it will listen on a socket for connections from another program, or a telnet session, and accept radio commands. After accepting a command, pcrd will disconnect from the socket and continue waiting for the next command. The default socket I picked (for no reason in particular) is Port 5151. You can change this by editing the _ASSIGNED_PORT_ define in the source code and recompiling, or you can override the default port when the daemon is started with a command line option. On the command line, use -C PORTNUMBER to override this default.

How do I use it? Here are a couple of examples to get you started:

`[root@BigDog pcrd]# ./pcrd`
`No frequency given`
`Usage is ./pcrd [-i] [-s <squelch>] [-v <volume>] [-d <device>] [-C port]`
`[-A 0|1] [-N 0|1] [-S 0|1] [-I <if_shift>] <freq> <mode> <filter>`
`Options:`
`-b = Daemon Mode (Background) - I ran out of letters!`
`-C = Use alternate socket port nnnnn`
`-X = eXit (only in Daemon Mode)`
`-D <0-9> = Set program debugging level`
`-R = Suppress radio status reporting while looping`
`-C <nnnn> = Use this port number for socket Communications`
`-l = Loop sending command to radio every 5 Seconds`
`-i = Initialize radio`
`-s <squelch> = Hex range from 00 to FF`
`-v <volume> = Hex range from 00 to FF`
`-O = Radio OFF`
`-d <port> = serial port. Default /dev/cua0`
`-A <0|1> = Automatic Gain Control <Slow | Fast>`
`-N <0|1> = Noise Blanker <Off | On>`
`-S <0|1> = RF Attenuator <Off | On>`
`-I <00 - FF> = IF Shift 80 is Center`
`Freq = 0.050 -> 1300`
`Modes = lsb,usb,am,cw,nfm,wfm`
`filter = 3,6,15,50,230`

`Example:`
`./pcrd 101.700 wfm 230`
`./pcrd 137.500 am 50`

`./pcrd looks for /dev/pcr1000 before using default port for radio connection`

`Socket communications are assigned to port 5151`

`This is ./pcrd Version 0.10`

The above printout shows the command breakdown that you would get from invoking the program without any command line options. This usage display gives a summary of the commands that are supported.

I normally start the daemon up on the server system like this:

`[root@dawg pcrd]# ./pcrd -i -b -v 30 -s 40 153.785 nfm 15`
`./pcrd Starting in Daemon Mode as PID 1328`
`[root@dawg pcrd]#`

The above command starts up with initializing the radio (turning the power on), with pcrd in daemon mode, volume set to 40 (hex), squelch set to 40, and tuned to 153.785 MHz (my local PD), Narrow Band FM, and a 15 kHz IF filter selected.

If you connect to the system running the daemon, you will see something like this:

`[root@BigDog pcrd]# telnet dawg 5151`
`Trying ...`
`Connected to dawg.icmp.com.`
`Escape character is '^]'.`
`Connected to pcrd Version: 0.07 PID: 1328`
`Up for 315 Seconds`
`OK Reply: 4722 NG Reply: 0`
`ReplyCount: 14530 Squelch: I004 Signal: I100 Offset: I280`
`Freq: 153.785000 Mode: 05 Filter: 02`
`Command ->`

Now, you can send a command to the radio. I'll just change the frequency to the local National Weather Service, on 162.475:

`Command ->162.475`
`Connection closed by foreign host.`

`[root@BigDog /root]#`

Note that the mode and filter, if not specified in the daemon mode socket connection based command string, will just be the same mode and filter that the radio was in, by default. You can, of course, change them to whatever you would like at the time of the command:

`[root@BigDog pcrd]# telnet dawg 5151`
`Trying ...`
`Connected to dawg.icmp.com.`
`Escape character is '^]'.`
`Connected to pcrd Version: 0.07 PID: 1328`
`Up for 387 Seconds`
`OK Reply: 6997 NG Reply: 0`
`ReplyCount: 20336 Squelch: I004 Signal: I100 Offset: I280`
`Freq: 162.475000 Mode: 05 Filter: 02`
`Command ->28.244 cw 3`
`Connection closed by foreign host.`
`[root@BigDog pcrd]#`

Oh, yes. Time for the BBC on the 49 Meter band.....

`[root@BigDog pcrd]# telnet dawg 5151`
`Trying ...`
`Connected to dawg.icmp.com.`
`Escape character is '^]'.`
`Connected to pcrd Version: 0.04 PID: 1328`
`Up for 424 Seconds`
`OK Reply: 7306 NG Reply: 0`
`ReplyCount: 21931 Squelch: I004 Signal: I100`
`Freq: 28.244000 Mode: 03 Filter: 00`
`Command ->6.175 am 6`
`Connection closed by foreign host.`
`[root@BigDog pcrd]#`

Just give it a try, and play around. I think that you will have some (limited) fun.

You also get some very limited status reporting from the radio in the socket mode. The amount of seconds that the daemon has been running on the host machine is reported, as well as a count of how many command replies from the radio were 'good' (G000), and how many were No Good (G001). ReplyCount is just an indicator of the number of serial reply packets that pcrd has received from the PCR-1000 while controlling it. Squelch indicates the state of the receiver squelch when the socket connection was established. I004 indicates that the squelch was closed, and I007 indicates that the squelch is open. Signal indicates the current received signal strength, from I100 to I1FF (with FF being the strongest). Offset (only valid in Narrow Band FM) provides the following information:

I200 Signal Frequency < Command Frequency
I280 Signal Frequency == Command Frequency
I2FF Signal Frequency > Command Frequency

Frequency shows the current frequency that the radio is set to (in MHz). Mode and Filter show the current settings as well:

Mode Settings:
00 == LSB
01 == USB
02 == AM
03 == CW
04 == Not used
05 == NFM
06 == WFM

Filter Settings:
00 == 3 Khz (actually 2.8 Khz) (CW USB LSB AM)
01 == 6 Khz (CW USB LSB AM NFM)
02 == 15 Khz (AM NFM)
03 == 50 Khz (AM NFM WFM)
04 == 230 Khz (WFM)

Another question that you may be asking is "Why would I want a daemon to control this radio remotely?" Well, I have the radio connected to a server in the basement that is running Speak Freely for UNIX . This is a open source streaming audio package that will run on just about any *NIX box that supports audio. There are also Windows versions available. A streaming audio reflector (sfreflect) is included in the package, so that you can run many listening clients connected to the audio source. I run the sfmike and sfreflect programs on this server, with the line output of the PCR-1000 connected to the line input of the sound card installed in the Linux server. Other clients on my home network can connect to the reflector and I will hear the audio from the radio out of the speakers of the network client. This works very well, and for listening to speech, takes very little network bandwidth, on the order of 1K bytes per second (per client). Most people will not even notice that this is going on in the background on your home 10 MBit/S Ethernet network.

Where do I download the latest pcrd source code? The current version is 0.10, and you should be able to find it here. One version older, Version 0.09, can be found here.

Are there any release notes? Yes. You can take a look at the minimal notes that I use to keep track of what I have done from one revision to the next. You can find these notes here. This way, you can take a look and see what I have changed, and decide if you want to upgrade the version you are using.

More work is on the way for this project, so feel free to send comments and suggestions to pcrd@icmp.com

Enjoy!

Carl Walker
WA1RAJ
Hollis, NH