SM7LCB, Antenna Switch Control
This page
will describe a simple general and/or antenna controller build around a
PIC16F876 microprocessor. As a general controller you will easy set output lines
to control different devices. The antenna control mode is developed for antenna
switch unit used at SK3W but can maybe be used at other places also. The control
interface used is based on the ICOM CI-V bus with the same physical interface
and also data address format but commands are normal ASCII formatted
text.
For this project I’m using PIC
microprocessors see my PIC page for more
information.
TOP
The schematic for the circuit
is shown in the figure below. As you see it more or less are only a
microprocessor and some interface circuits. Schematic will soon be
updated!
BILD
Click on above picture for a PDF
document.
- The main part is a microprocessor
from Microchip PIC16F876(A).
- The connector J1 is used to program
the microprocessor (ISP) and also for power supply to the unit
(+5VDC).
- The buffer IC2A/B is used as an ICOM
bus interface (CIV).
Other simpler interface possible to
use.
- Output driver.
- ULN2803A as pull
down driver.
- UDN2981A as high driver.
- Input network.
Maximum input
level is 5V, higher level will destroy the microprocessor.
- Analog input.
Maximum input level
is 5V, higher level will destroy the microprocessor.
Possibility to connect
an LM50 for temperature measurement.
TOP
The
microprocessor needs to be loaded with the rotor control software. You can
download the software here and then you need programming software, which can
download the file into the microprocessor over the program interface (see the
schematic). The software is currently only possible to get in the HEX file
format.
LCB-CTRL01-1.00
|
[?? ???
2007]
First
released version of the general/antenna controller.
|
The hexfile
include fuse (configuration bits) setting for the PIC processor. But if the PIC
programmer you are using don’t get the fuse (configuration bits) setting from
the file you may need to set then manual in the PIC programmer, see table
below.
Name |
Use |
Setting |
FOSC1, FOSC0 |
Oscillator Selection bits. |
01 = XT oscillator |
WDTE |
Watchdog Time Enable bit. |
0 = WDT desabled. |
PWRTE |
Power-up Reset Enable bit. |
0 = PWRT enabled. |
BODEN |
Brown-out Reset Enable bit |
1 = BOR enabled. |
LVP |
Low Voltage In-Circuit Serial Programming Enable bit. |
0 = RB3 is digital I/O, HV on MCLR must be used for programming. |
CPD |
Data EE Memory Conde Protected. |
1 = Code protection off. |
WRT |
FLASH Program Memory Write Enable. |
Don't care. |
DEBUG |
In-Circuit Debuger Mode. |
1 = In-Circuit Debugger disabled, RB6 and RB7 are general purpose I/O pins. |
CP1, CP0 |
FLASH Program Memory Code Protection bits. |
11 = Code protection off. |
TOP
After
program load and new restart of the microprocessor you hopefully will get a
message from the unit on the ICOM bus. It will tell you the current address of
the unit and the program version it’s loaded with.
“vLCB-CTRL01-01.00”
TOP
Before
using the unit we need to configure the unit. During this configuration we will
setup the ICOM CI-V address, operation mode etc. During this process it’s good
practice to only have the unit for configuration on the ICOM bus. These to
ensure that you don’t by accident reconfigure a used operational unit in the
system during the configuration. It’s also good practice to have a unit address
list with all used/allocated address so you now which addresses are used and
what type of unit uses that address.
The
configuration will be done using the M command, see table below and example
below.
General Controller
“M30C8300FF”
|
General
controller unit with address 0x30.
Enable
timeout on output channel (0x83) 8, 3, 2 and 1.
Other
settings not used in this mode.
|
Antenna Controller
“M40A4000FF”
|
Antenna
controller unit with address 0x40.
Enable
timeout on output channel (0x40) 7.
Last 'F'
indicate using all four antennas.
Other
settings not used in this mode.
|
Antenna Master
“M50M40FF”
|
Antenna
master unit with address 0x50.
Enable
timeout not used in this mode.
Master will
control antenna unit with address 0x40.
Master will
use fixed band selection mode.
|
TOP
All command
to this controller is sent over the ICOM CIV bus and they are not following any
used standard. The commands are using only ASCII characters for easy use. To get
information how you shall embed these commands into the ICOM CIV bus please read
link information for the bus itself.
In the ICOM
CIV bus all ICOM radios have a common address (0x00). For LOGGER units on the
same bus I have been using address 0x01 as a common address for units to
broadcast information. In the command table there is notes if the message can be
sent over this common address. There is also a note if the command will return
the standard ICOM messages for OK and NOT OK command. Check this return message
if you want to no if it when OK or NOT OK!
Table below
show the common and setup commands for the unit independent of operation
mode.
Command
|
Function
|
Common
|
Response
|
!
|
Get loaded
code version from the unit.
Version
string “vLCB-CTRL01-01.00”.
|
At power
on.
|
version string
|
M?
|
Get current
mode, se below
(starting with a small ‘m’ character).
|
-
|
see set mode
|
Maacttssbe
|
Set
mode
- Unit address in hexadecimal number
aa = 33 will be address 0x33.
Valid address range is 0x02 –
0xF0.
- Unit mode (c):
’C’ = unit as
general controller.
’A’ = unit as antenna controller.
’M’ = unit as
antenna master.
- Enable output timeout setting (“tt”)
(0x00-0xFF).
Ex 8F enable timeout for output 8, 4, 3, 2 and 1.
Timeout occur
after 60 seconds last update of output via the ‘O’
command.
The
following setting is only valid in the Antenna Master
Mode.
- Slave address (“ss”) in hexadecimal
number. Will be the unit address of the antenna control unit the master shall
control.
- Band selection type (‘b’) is used when slave
address is set (none zero address). The input code on 4 inputs is used to set
the selected band. There are 3 type of band selection.
- ‘F’ as fixed (no
band selection).
- ‘5’ as 5 band selection.
- ‘H’ as hexadecimal decoding.
The band selection will add a value to set slave address and use this new
address for sending commands to slave antenna unit (selected band).
Antenna Control setting.
- The ‘e’ setting will enable which
antenna the antenna control unit can control. This is a hexadecimal value 0 to
F.
- Bit 0 enable antenna 1.
- Bit 1 enable antenna 2.
- Bit 2 enable
antenna 3.
- Bit 3 enable antenna 4.
|
- |
CIV
OK/NOT OK
|
Ax?
|
Retrieve
analog value from channel x (1-3).
Format
“Axx;yyy;”
- xx is % value referred to
5V.
Input range 0-5V.
- yyy is analog value converted to
temperature assuming temperature sensor LM50.
|
-
|
“Axx;yyy;”
|
TOP
The general
control unit has 8 in/outputs possible to read/write from other units via ICOM
bus commands. For each output it’s possible to enable timeout, clearing the
output setting if no update the last 60 seconds. There are also 3 analog inputs,
which can be read with percent value (range 0 – 5 VDC) and as temperature value
in Celsius degrees when the analog input is connected to the LM50 temperature
sensor.
Command
|
Function
|
Common |
Response |
Oxxxxxxxx
|
Switch
output on/off (‘1’/’0’).
The outputs
order is: “87654321”.
|
- |
CIV
OK/NOT OK |
Ox:y
|
Switch
output channel x off/on.
- x is output ‘1’ to
‘8’.
- y is setting off/on
(‘0’/’1’).
|
- |
CIV
OK/NOT OK |
O?
|
Retrieve
the output status.
Format
“Oxxxxxxxx”.
The output
order is: “87654321”.
|
- |
“Oxxxxxxxx” |
I?
|
Retrieve
the output status.
Format
“Ixxxxxxxx”.
The output
order is: “87654321”.
|
- |
“Ixxxxxxxx” |
TOP
Text
Command
|
Function
|
Common
|
Response
|
Sxyz
|
Set antenna
selection.
- x is setting for antenna number 1
(‘1’-‘4’).
- y is setting for antenna number 2
(‘1’-‘4’).
- z is an optional data RX/TX status
(‘R’/’T’)
(not using during setting).
|
-
|
CIV
OK/NOT OK
|
S?
|
Retrieve
current setting.
Format
“Sxyz”.
For x, y
and z see Sxyz command above.
|
-
|
“Sxyz”
|
Oxx
|
Switch
output on/off (‘1’/’0’).
The outputs
order is: “87”.
|
-
|
CIV
OK/NOT OK
|
Ox:y
|
Switch
output channel x off/on.
- x is output ‘7’ to
‘8’.
- y is setting off/on
(‘0’/’1’).
|
-
|
CIV
OK/NOT OK
|
O?
|
Retrieve
the output status “Oxx”.
The output
order is: “87”.
|
-
|
“Oxx”
|
change
of
state
|
When the
unit get an updated via command or via key input the unit will send a status
message “Sxyz” on the common LOGGER address (0x01).
|
Yes
|
“Sxyz”
|
TOP
In the
antenna master mode the unit will control an antenna control unit. Pushing the
antenna selection key will send a command to the slave unit. There is also a
possibility to add band selections switch to the unit to be able to select the
slave unit handling the selected band.
Fixed
Band Selection
…
5 Band
Selection
…
Hex Band
Selection
…
Command
|
Function
|
Common
|
Response
|
Sxyz
|
Set antenna
selection.
- x is setting for antenna number 1
(‘1’-‘4’).
- y is setting for antenna number 2
(‘1’-‘4’).
- z is an optional data RX/TX status
(‘R’/’T’)
(not using during setting).
Note: ONLY from slave unit as response on “get
status” request!
|
-
|
CIV
OK/NOT OK
|
change
of
state
|
When the
operator via key input change setting the unit will send new status to the slave
unit.
|
-
|
“Sxyz”
|
get
status
|
When unit
start up it will retrieve the current status from the slave unit. It will also
get status when changing band via the band selection
input.
|
-
|
“S?”
|
TOP
|