Abstract
This howto is to setup and test the
SeaLevel Systems 462 TTL I/O module.
Hardware Setup and Testing
First we will test that the hardware is working properly using the program supplied by SL.
Hardware: PC with a free ethernet port , CAT5 cable,
SeaLev box, and power for
SeaLeV (12 - 15 Volts). Connect the ethernet between the PC and SL box.
Power it up. You can/should have the manual available.
There are two libs that install in Program Files: "SeaIO" and "SeaLevel System" . If you don't have them use the supplied CD rom or go to
ftp://ftp.sealevel.com/pub/SOFTWARE
and open folders SEAIO and
SeaMAX. Go inside and get the current .exe and install the libs. The .dlls will by default be installed in WINDOWS.
The testing program is
MaxSSD.exe. It will find and allow you to assign an ethernet port and the number of the slave device(1).
When you get to the window with buttons, remember TTL on (green) is 0 Volts.
To activate a channel, turn it off (grey) which should give 5V on the output.
The 96 channels are divided into 16 channel "banks".
If all goes well, then proceed to install the HCAL/DCS DIM server software.
Server Software
The software you will need is: DIM, C++ project file , and a MS C++ compiler.
I used the free Microsoft compiler, but it
should work fine with Visual Studio or .NET.
Make sure DIM installed is installed. If not go to
http://dim.web.cern.ch/dim/
. Be sure to configure dns.exe following the instructions.
If you are lucky, the project file will build everything. Otherwise you will need to create the project from the sources and libraries.
Sources and headers:
ComplexDimCommand.cpp - DIM command handler
ComplexDimCommand.h
SeaLev.cpp - class which encapsulates the hardware functions
SeaLev.h
SeaLevelClient.cpp - main client
SeaLevelServer.cpp - simple server
stdafx.cpp - junk for pre-complied headers
stdafx.h
Libraries and headers:
CSeaMaxW32.lib - C driver libraries for Win 32 bit architecture
seaMaxW32.h
seario.h
Build server and client.
Running the Server and Client
The server is designed as a DIM command event handler. An event in this case is a change in any of the three values of an integer array. These integers control the operation of the program. The DIM names are: "CMS/HCAL/DCS/SEALEV/PORT[0:2]
The first value (slave) is the device number , either (1,2). This corresponds to the slave device number of
SeaLevel boxes that can be chained together. The current code will work for up to two devices.
The second value (channel) turns on(5V) a channel (1->96). A negative value (-1->-96) will turn off the channel(0V).
The third value (mode) controls the actions as follows:
0 - to turn on/off a channel
1 - reinitialize the program , it is automatically initialized at startup.
2 - or any other number will read back the configuration
The program will publish the following values:
CMS/HCAL/DCS/SEALEV/BANK0
CMS/HCAL/DCS/SEALEV/BANK1
which correspond to the "states" of the different boxes. The format is a 24 hex characters which are read left-to-right, e.g.
BANK0= 0100 0000 0000 0000 0000 0000
means that channel 8 is on.
The values:
CMS/HCAL/DCS/SEALEV/ERROR0
CMS/HCAL/DCS/SEALEV/ERROR1
correspond to error codes given in Appendix 1.
The JCOP Framework state machine software should use these values to determine the overall state of the system.
To operate the system:
First run dns.exe
SeaLevelServer.exe 1 sealevel_tcp://169.254.200.140
or whatever tcp name you have
run
SeaLevelClient
Exporting the Executable
Configuration using the Comtrol and RS-422 SL
Appendix 1 - error codes
void
SeaLev::printError(int error, int result, int slave)
{
if(error>0){
switch(error)
{
case (1<<0):
printf("ERROR %4X Slave %i Open failed, Returned %i\n",error,slave,result);
if ( result==-38) printf("Invalid name \n");
else if ( result==-22) printf("Invalid protocol\n");
else if ( result== -9) printf("Invalid location\n");
break;
case (1<<1):
printf("ERROR %4X Slave %i Error calling Ioctl - IOCTL_READ_COMM_PARAM, Returned %i \n",error,slave,result);
if ( result==-22) printf("Null pointer\n");
break;
case (1<<2):
printf("ERROR %4X Slave %i Error Writing to Programmable IO, Returned %i \n",error,slave,result);
if ( result==-14) printf("Modbus read exception \n");
else if ( result==-22) printf("Null pointer\n");
else if ( result== -9) printf("No communication\n");
else if ( result==-18) printf("No connection\n");
else if ( result==-19) printf("No response\n");
else if ( result==-34) printf("Port out of range\n");
else if ( result==-27) printf("Illegal data\n");
break;
case (1<<3):
printf("ERROR %4X Slave %i Error Reading from Programmable IO, Returned %i \n",error,slave,result);
if ( result==-14) printf("Modbus read exception \n");
else if ( result==-22) printf("Null pointer\n");
else if ( result== -9) printf("No communication\n");
else if ( result==-19) printf("No response\n");
break;
case (1<<4):
printf("ERROR %4X Slave %i slave or channel out of range %i\n", error, slave,result);
break;
case (1<<5):
printf("ERROR %4X Slave %i Error Writing to Holding Registers, Returned %i\n",error,slave,result);
break;
case (1<<6):
printf("ERROR %4X Slave %i Error Reading from Holding Registers, Returned %i \n",error,slave,result);
break;
case (1<<7):
printf("ERROR %4X Slave %i Not initialized %i\n",error,slave,result);
break;
default:
printf("ERROR %4X Slave %i Unknown error %i\n",error, slave,result);
break;
}
DCS Links
Wiki Tools: