Developers Area - Windows API
Introduction
Since ARSWIN V1.5k two API's are available:
The ARSWIN includes a DDE Server, so any 16 or 32 bits program can interface
with it as a Client DDE. Similar for Windows Messaging, however this interface
has being simplifier and just support only 2 commands: Move the Azimuth or
Elevation Antenna to an angle.
I suggest to support the DDE Method, however depending the Language you are
using, or how many commands or control you need, the Windows Messaging will be
easier to devellope and support.
DDE API
The DDE is a standard method developed by Microsoft that allows interface
between them 2 programs..
ARSWIN DDE Interface
If you want your Aplication can interface with the ARSWIN via DDE, you must
load the ARSWIN Aplication, before trying to connect to the ARS Server. So, it's recommended to check if the ARSWIN is running before call it.
For instance, you can use to the SDK Function called:
ret=GetModuleHandle("ARSWIN")
If "ret" is equal to 0, it means it's not running the "ARSWIN" Aplication, so you cannot use the DDE method.
If you know how the DDE Interface works, what is a TOPIC, ITEM, and so on, you can continue reading this document, if not, it's recomended to read
in your Language Reference Manual the information about DDE specification.
I assume that you have any experience using the DDE Interface.
For connecting to the ARSWIN you must enter the following parameters:
Aplication: ARSWIN
Topic: RCI
Item: AZIMUTH
In Visual Basic, the code is as follows:
LinkTopic = "ARSWIN|RCI"
LinkItem = "AZIMUTH"
Just when you have connected to the ARSWIN DDE-Server, the data exchange can
begin. This is called a "conversation".
When the conversation is open, you can send COMMANDS to the ARSWIN, or receive
the RESPONSES.
Every command will be returned by a response. However, each time the heading is
changed, i.e. you are turning around manually your control unit, the ARSWIN will notify the new
heading.
COMMANDS
Eight (8) Commands/Responses are
supported:
- Read Azimuth Position,
"RA:"
- Read Elevation Position,
"RE:"
- Read Digital Azimuth ADC,
"DA:"
- Read Digital Elevation ADC,
"DE:"
- Turn the Azim. rotor to a
point, "GA:new_AZ_angle_value"
- Turn the Elev. rotor to a
point,
"GE:new_EL_angle_value"
- Get the RCI Status, "ST:"
- Active any Relay Manually, "AR:relay_value"
1) Read Azimuth Position.- (RA:)
Used every time you want to know where is the antenna heading (Azimuth). You can send this command "RA:" and the ARSWIN will return the antenna Azimuth angle, for instance: "RA:33", it means the antenna is at 33 Degrees.
VB example: (we assume there is a TEXTBOX called: "TxtCommand"
COMMAND: Your_Aplication ----> ARSWIN
TxtCommand.Text = "RA:"
TxtCommand.LinkPoke
RESPONSE: ARSWIN ----> Your_Aplication
The ARSWIN writes in the TxtCommand.Text the value =
"RA:33"
(Back)
2) Read Elevation Position.- (RE:)
Used every time you want to know where is the antenna heading (El). You can send this command "RA:" and the ARSWIN will return the antenna Elevation angle, for instance: "RE:45", it means the antenna is
at 45 Degrees.
VB example: (we assume there is a TEXTBOX called: "TxtCommand"
COMMAND: Your_Aplication ----> ARSWIN
TxtCommand.Text = "RE:"
TxtCommand.LinkPoke
RESPONSE: ARSWIN ----> Your_Aplication
The ARSWIN writes in the TxtCommand.Text the value = "RA:45"
(Back)
3) Read Azimuth ADC.- (DA:)
Used every time you want to know the Azimuth ADC Value. You can send this command "DA:" and the ARSWIN will return the antenna Azimuth ADC Value. It should be any value between 0-255 for a 8 bits ADC (standard) or between 0-4095 for the 12 Bits ADC.
VB example: (we assume there is a TEXTBOX called: "TxtCommand"
COMMAND: Your_Aplication ----> ARSWIN
TxtCommand.Text = "DA:"
TxtCommand.LinkPoke
RESPONSE: ARSWIN ----> Your_Aplication
The ARSWIN writes in the TxtCommand.Text the value = "RA:242"
(Back)
4) Read Elevation ADC.- (DE:)
Used every time you want to know the Elevation ADC Value. You can send this command "DA:" and the ARSWIN will return the antenna Azimuth ADC Value. It should be any value between 0-255 for a 8 bits ADC (standard) or between 0-4095 for the 12 Bits ADC.
VB example: (we assume there is a TEXTBOX called: "TxtCommand"
COMMAND: Your_Aplication ----> ARSWIN
TxtCommand.Text = "DE:"
TxtCommand.LinkPoke
RESPONSE: ARSWIN ----> Your_Aplication
The ARSWIN writes in the TxtCommand.Text the value = "RA:192"
(Back)
5) Turn the rotator to an Azimuth specific point.- (GA:XXX)
If you want the ARSWIN Goes to an Azimuth angle (GA) you will send this command, GA:XXX where XXX means the Azimuth angle you wish.
For instance: "GA:90", it means you wish to turn the antenna to 90.
COMMAND: Your_Aplication ----> ARSWIN
TxtCommand.Text = "GA:90"
TxtCommand.LinkPoke
RESPONSE: ARSWIN ----> Your_Aplication
No response is significant.
(Back)
6) Turn the rotator to an Elevation specific point.- (GE:XX)
If you want the ARSWIN Goes to an Elevation angle (GE) you will send this command, GE:XX where XX means the Elevation angle you wish.
For instance: "GE:50", it means you wish to turn the antenna to 50. For a proper operation, this
angle should be between 0-90 degree.
Their is not a reason for making the Elevation setup over 90 degrees
COMMAND: Your_Aplication ----> ARSWIN
TxtCommand.Text = "GE:50"
TxtCommand.LinkPoke
RESPONSE: ARSWIN ----> Your_Aplication
No response is significant.
(Back)
7) Get the RCI Status.- (ST:)
If you wish to know if any relay is active. The "ST:" command will be returned with the response: "ST:Y" Where Y is the relay value.
"Y" value can be:
0 = All relays are stopped.
1 = The Brake relay is active
2 = The Left relay is active
4 = The Right relay is active.
16= The Up relay is active
48= The Down relay is active.
Any combination can be accepted: 1+16 = Brake relay + Up
COMMAND: Your_Aplication ----> ARSWIN
TxtCommand.Text = "ST:"
TxtCommand.LinkPoke
RESPONSE: ARSWIN ----> Your_Aplication
The ARSWIN, for instance, writes in the TxtCommand.Text the relay value = "ST:16". So the Up relay is active.
(Back)
8) Active any Relay Manually.- (AR:Z)
If you want your aplication active/desactive any relay.
It's not recommended to use this command!
If you want any way to active the Left or Right Relay, it's not necesary to activate first the Brake and later the Left relay. Just you activate the Left or Right relay, and the ARSWIN will active the Brake relay before.
The command will be as follow: "AR:Z"
Where Z is equal:
0 = All Azimuth relays will be stopped.
2 = The Left and Brake relays will be active
4 = The Right and Brake relays will be active.
7 = All Elevation relays will be stopped.
6 = The Up relay will be active.
8 = The Down relay will be active.
COMMAND: Your_Aplication ----> ARSWIN
TxtCommand.Text = "AR:2" ' Left turn
TxtCommand.LinkPoke
RESPONSE: ARSWIN ----> Your_Aplication
No response is significant.
(Back)
SAMPLES:
I include 2 samples with the source (VB)
ARSCLI:
This programs is included with the product. It's a simple sample where
you can see how the ARSCLI and ARSWIN are linked using the DDE.
You can download the sources: HERE
ARSTRACK
I developed this program because Conrad G0RUZ wanted to use for his EME
station the TRACKER program by W7GJ. This program writes every minute at the
file AZEL.DAT the "UTC" Time, the Azimuth value, and the Elevation
value. So the ARSTRACK reads at begining each minute, this file and sends
via DDE to the ARSWIN those values. Later, David GM4JJJ and Paul N1BUG
uses the same
formula for interfacing between his EME program (MoonSked) and the ARSWIN.
You can download the sources: HERE
I would appreciate if you inform me that you have developed something!
WINDOWS MESSAGING API
The Windows Messaging it's a very simple method to interface with the ARSWIN.
Just few commands will be used:
- FindWindow just for locating the ARSWIN
window handler
- RegisterWindowMessage just for registering
the Message
- PostMessage or SendMessage
just for sending the commands.
AZIMUTH COMMAND:
The Register Window Name will be "AZIMUTH"
The first parameter will be the ANGLE, and the second will be "0"
(Zero).
- If ANGLE = -1 then the Azimuth Rotator will
STOP
ELEVATION COMMAND:
The Register Window Name will be "AZIMUTH"
The first parameter will be the ANGLE, and the second will be "1"
(One).
- If ANGLE = -1 then the Elevation Rotator
will STOP
EXAMPLE:
// Find the ARSWIN windows handler
lpClassName = "ThunderForm" ;
pCaption = "ARSWIN" ;
hWndARS = FindWindow(lpClassName,
lpCaption) ;
// Register the AZIMUTH window message
lpClassName = "AZIMUTH" ;
MsgARSAz = RegisterWindowMessage(lpClassName)
;
// Send a message to the ARS, for turn Azimuth to any angle
// Angle --> any value between 0-360
// Example: Turn Azimuth to 200 degrees
Angle = 200;
Rotor_Type = 0 ; // Azimuth
ret = PostMessage(hWndARS, MsgARSAz, Angle,
Rotor_Type ) ;
// Example: Turn Elevation to 45 degrees
Angle = 45
Rotor_Type = 1 ; // Elevation
ret = PostMessage(hWndARS, MsgARSAz, Angle,
Rotor_Type ) ;
// Example: STOP Azimuth
Angle = -1;
Rotor_Type = 0 ; // Azimuth
ret = PostMessage(hWndARS, MsgARSAz, Angle,
Rotor_Type ) ;
// NOTE>: POSTMESSAGE will be better than SENDMESSAGE
|