![]() |
![]() |
|||||||||||||||||
|
Developers Area - Windows API Introduction With ARSWIN V1.5k two API's are available:
ARSWIN includes a DDE Server, so any 16 or 32 bit program can interface with it as a DDE Client. Similar for Windows Messaging, however this interface has being simplified and supports only two commands: Move the Azimuth or Elevation of antenna to an angle. I recommend the DDE Method, however depending on the Language you are using, how many commands, or type of control you need, Windows Messaging may be easier to develop and support. DDE is a standard method developed by Microsoft that allows interface between two programs.
ARSWIN
DDE Interface
If you want your Application to interface with ARSWIN via
DDE, you must load the ARSWIN Application, before trying to connect to the ARS
Server. It is recommended to check if the ARSWIN program is running before you
call it. Application:
ARSWIN In Visual Basic, the code is as follows: LinkTopic =
"ARSWIN|RCI" When you have connected to the ARSWIN DDE-Server, data
exchange can begin – this is called a "conversation". Eight (8) Commands/Responses are supported: - Read
Azimuth Position,
"RA:" 1) Read Azimuth Position.- (RA:) Used every time you want to know the antenna heading
(Azimuth). You can send the command "RA:" and ARSWIN will return the
antenna Azimuth angle. For instance: "RA:33" means the antenna is at
33 Degrees. TxtCommand.Text = "RA:" RESPONSE: ARSWIN ----> Your_Application ARSWIN writes in the TxtCommand.Text the value = "RA:33" 2) Read Elevation Position.- (RE:) Used every time you want to know the antenna heading (El).
You can send the command "RA:" and ARSWIN will return the antenna
Elevation angle. For instance: "RE:45" means the antenna is at 45
Degrees. TxtCommand.Text = "RE:" RESPONSE: ARSWIN ----> Your_Application ARSWIN writes in the TxtCommand.Text the value = "RA:45" Used every time you want the Azimuth ADC value. You can
send the command "DA:" and ARSWIN will return the antenna Azimuth ADC
value. It should be a value between 0-255 for an 8 bit ADC (standard) or between
0-4095 for a 12 Bit ADC. TxtCommand.Text = "DA:" RESPONSE: ARSWIN ----> Your_Application ARSWIN writes in the TxtCommand.Text the value = "RA:242" Used every time you want the Elevation ADC value. You can
send the command "DA:" and ARSWIN will return the antenna Azimuth ADC
value. It should be a value between 0-255 for an 8 bit ADC (standard) or between
0-4095 for a 12 Bit ADC. TxtCommand.Text = "DE:" RESPONSE: ARSWIN ----> Your_Application ARSWIN writes in the TxtCommand.Text the value = "RA:192" 5) Turn the rotor to an Azimuth specific point.- (GA:XXX) If you want to position your rotor through ARSWIN to an
Azimuth angle (GA) you will send this command: GA:XXX, where XXX means the
Azimuth angle you wish to position the rotor to. TxtCommand.Text = "GA:90" RESPONSE: ARSWIN ----> Your_Application No response is expected. 6) Turn the elevator to an Elevation specific point.- (GE:XX) If you want to position your elevator through ARSWIN to an
Elevation angle (GE) you will send this command: GE:XX, where XX means the
Elevation angle you wish to position the elevator to. There is no reason for making the Elevation setup over 90
degrees. TxtCommand.Text = "GE:50" RESPONSE: ARSWIN ----> Your_Application No response is expected. If you wish to know if any relay is active, the "ST:" command will return the response: "ST:Y" Where Y is the relay value. "Y" value can be: 0 = All relays are stopped. COMMAND: Your_Application ----> ARSWIN TxtCommand.Text = "ST:" RESPONSE: ARSWIN ----> Your_Application For example, ARSWIN writes into TxtCommand.Text the relay value = "ST:16" - the Up relay is active. 8) Activate any Relay Manually.- (AR:Z) If you want your application to activate/deactivate any
relay.
Where Z is equal to: 0 = All Azimuth relays will be stopped. COMMAND: Your_Application ----> ARSWIN TxtCommand.Text = "AR:2" ' Left turn RESPONSE: ARSWIN ----> Your_Application No response is expected. SAMPLES:
I have included two samples with the source code (VB). ARSCLI: This program is included with the product. It's a simple sample where you can see how the ARSCLI and ARSWIN are linked using DDE. You can download the source: HERE ARSTRACK I developed this program because Conrad G0RUZ wanted to use the TRACKER program (by W7GJ) for his EME station. This program writes every minute to the file AZEL.DAT - the "UTC" Time, the Azimuth value, and the Elevation value. The ARSTRACK reads at beginning of each minute this file and sends via DDE to ARSWIN those values. Later, David GM4JJJ and Paul N1BUG used the same formula to interface between his EME program (MoonSked) and ARSWIN. You can download the source: HERE I would appreciate if you inform me when you have developed something! Windows Messaging is a very simple method for interfacing
with ARSWIN. Just a few commands will be used: ·
FindWindow - for locating the ARSWIN window handler ·
RegisterWindowMessage
- for registering the Message ·
PostMessage or SendMessage - for sending
commands. AZIMUTH COMMAND:
The Register Window Name will be "AZIMUTH" The first parameter will be the ANGLE and the second will be "0" (Zero).
ELEVATION
COMMAND:
The Register Window Name will be "AZIMUTH" The first parameter will be the ANGLE and the second will be "1" (One).
EXAMPLE:
// Find the ARSWIN windows handler hWndARS = FindWindow(lpClassName, lpCaption) ; // Register the AZIMUTH window message lpClassName = "AZIMUTH" ; MsgARSAz = RegisterWindowMessage(lpClassName) ; // Send a message to the ARS to turn Azimuth to any angle // Example: Turn Azimuth to 200 degrees ret = PostMessage(hWndARS, MsgARSAz, Angle, Rotor_Type ) ; // Example: Turn Elevation to 45 degrees ret = PostMessage(hWndARS, MsgARSAz, Angle, Rotor_Type ) ; // Example: STOP Azimuth ret = PostMessage(hWndARS, MsgARSAz, Angle, Rotor_Type ) ; // NOTE>: POSTMESSAGE will be better than SENDMESSAGE |
|||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||
|
Site Map | Terms
of Use | Copyright 2007 | ||||||||||||||||||||||||||||||||||||||||||||