"ISEG Power Supply programming"
01/31/10 ISEG Power Supply LabVIEW programming ( Internal repport ) C.Toader 7/14/00 Required Hardware: - NT Workstation; - National Instruments PCI-CAN interface; - ISEG/ ECH-208 Crate/ Containing MHCC 64 Can Controller; - ISEG/ EHQFxxx_ Modules. Required Software - LabVIEW 5.1 or higher; - NI-CAN Software for Windows 95/98 and Windows NT version 1.3 or higher downloadable at http://digital.ni.com/softlib.nsf/websearch?SearchView&Query=NI-CAN Control cable: Max tested length : 25 m Connector type: 9-Pin Sub-D (Female Connector) <---------------------> (Male connector) One to one connection The Pin 5 on the both sides connected to the ground (shield) CAN-Line-Terminator. Prior required information: - ISEG 16-channel High Voltage Power Supply EHQ F005p / Operators Manual.Vers 2.1 as of 1999-11-05 - Controller Area Network / CAN : Any general introduction. Easy to found at http://www.can-cia.de/ - NI-CAN User Manual for Windows 95 and Windows NT/ National Instruments November 1997/ Part Number 321370B-01 http://www.ni.com/pdf/manuals/321370c.pdf 1. ISEG Programming Information 1.1 Data Format The datagram structure is matched to the message frame of the standard-format according to CAN specification 2.0A. From the point of view of the CAN protocol a simple data transmission will be done. This means that the RTR (Remote Transmission Request) bit is always set to 0. Remark: Only modules with the same baudrate can be used in the same crate. The succesfully tested configuration used a baudrate of 100 kb/sec. 1 01/31/10 The command datagram (see § 4.4 in ISEG Operators Manual) will be transferred as data-word with n-bytes length in the data field of the CAN frames where n depends on the commands specific dimension. The DLC (Data Length Code) will be set according to this length. A short explanation of this dataframe format is given below: S Identifier R Reserved DLC Data_ID Data (n-2) … … CR Ac O T n=1-8 C k F R F. b11…b0 00 b3…b0 b7…b0 b7…b0 15b Identifier Zoom ID10 ID9 ID8 ID7 ID6 ID5 ID4 ID3 ID2 ID1 ID0 0 0 A5 A4 A3 A2 A1 A0 … … Data DIR The ID8 to ID3 (or A5..A0) bits are used to address the module 0..64 but in the case of a single crate only ID5 to ID3 (A2.. A0) are important. ID10,ID9 are 0 and ID2, ID1 are not used (they can be set 0 as well). The information for the direction of the data transfer DATA_DIR is written in the lowest bit ID0 of the CAN identifier. Therefore the controller (Control PC) will ask for data with DATA_DIR = 1 (read) and will send data with DATA_DIR = 0 (write). The Front-end device (ISEG module) will answer to the data request with datagrames having DATA_DIR = 0. There is only one “read” datagram sent on the CAN network by an ISEG module and this is the registration request message. The DATA_ID field identify the command and, when this is a single channel command the address of the channel to operate. The last four bits in the Data_ID are in the mentioned case used to address the channel 0..15. The next data fields are containing the arguments of the given command. This numerical data are often coded on two bytes with a resolution depending on the maximal value attainable with the respective module (i.e. the voltages, currents, rampspeeds are module type dependent). Because a detailed list of the available commands as CAN dataframes is given in the § 4.3 of ISEG Operators Manual we will give here only some examples on how you can form some important ones. 1.2 Command examples A ) SET VOLTAGE 5 V ON THE CHANNEL 0 OF THE MODULE 0 THE MODULE TYPE IS EHQF00p. Identifier R Reserved DLC Data_ID Data (1) Data (0) T N=1..8 R 0 0 00 11 10100000 1 11110100 2 01/31/10 Explanation: This is a write command ID0=0 addressed to the first module ID8..ID3=0 so the identifier will be 0. i.e. 1010 + 0000=”set voltage” + ”on the channel 0”.The resolution of the voltage setting is given by value R= Vmax/50000 and for the EHQF005p this becomes R=0.01. For a 5V tension we have to send a value of 500 coded on two bytes (16 bit) i.e. 111110100. Because the CAN datafields are 8 bit long, we will have DLC=3 and three data fields in total: Data_ID, Data(1) and Data(0). B) READ SET VOLTAGE ON THE CHANNEL 0 OF THE MODULE 0 THE MODULE TYPE IS EHQF00p. Identifier R Reserved DLC Data_ID T N=1..8 R 1 0 00 1 10100000 C) READ ACTUAL VOLTAGE ON THE CHANNEL 0 OF THE MODULE 0 THE MODULE TYPE IS EHQF00p. Identifier R Reserved DLC Data_ID T N=1..8 R 1 0 00 1 10000000 If the actual tension is 100 V the module answer will be : Identifier R Reserved DLC Data_ID Data (1) Data (0) T N=1..8 R 0 0 00 11 10100000 100111 10000 Remark: the SET voltage is applied on the given channel after this is switched (SET) ON the existing voltage is the value read in the example C). 1.3 Configuration Test Before any programming activity you have to ensure that the connection is set- up correctly and your NI/PCI-Can card can listen and talk to the crate. The easiest way to do this is to use an interactive program for CAN monitoring given as an example in the NI-CAN software named Interact.vi. If the nican13 has been installed properly you will find the useful vi in the …\National Instruments\LabVIEW\EXAMPLES\nican\. The Interact.vi gives you also the posibility to transmit or periodically transmit data frames i.e manually form a command dataframe. Another advantage is that you don’t have to take care of SOF, CRC or Ack.F. etc. Step 1) Switch OFF the ISEG crate. Connect the control cable and the terminator. 3 01/31/10 Step 2) RUN the Interact.vi with the settings given in fig. 1. i.e. 100kb baudrate, CAN1 interface (or according to configuration1) and no periodically transmit data (the white square is empty). Step 3) Switch ON the ISEG crate. At the power on each modules will start to send periodically a registration request. These registration requests should scroll in the Data Frame Array and you should be able to see and identify them (Data_ID: 11011000). i.e. a registration request sent by the second module( Log-on front-end device) Step 4) Write interactively the following command on the CAN net: i.e. registration accepted for the second module (or Log-on controller). The second module should stop sending the command you have identified at the Step 3) and accept other commands. If no valid command is sent during two minutes the module will disconnect automatically and start to send again the registration request data frame. Remark: This was a very difficult step at the first approach because of the leak in documentation: The default baud rate is set to 125kb from the factory but the real baud rate is only 121kb because of an inapropriate quartz oscillator. The PEAK 1 Your first CAN port can be assigned to the 0 address therefore this should be checked before using the NI-Config utility. 4 01/31/10 CAN test system delivered with the modules system could listen to modules but not our PCI-CAN card. The adopted solution was to use the test program to set the baud rates of each module to a value non which coincides with the declared one, 100kb. 2. The SHIPTRAP-ISEG-DRIVER 2.1 Functions and VI’s Almost all the important commands have been compiled into a device driver called ISEG.llb. The application example show the use of the most important ones and the basic steps in programming an ISEG utility. http://www-wnt.gsi.de/shiptrap/Drivers/ISEG/EXAMPLE1_SET_READ.html The first operation is to configure then to open a CAN-Network connection using ISEG_Open_Can.vi The second operation is to notify the ISEG modules that a controller is active (register the modules) by a Log-on controller command written by the ISEG_LogOn_CONTROLER.vi The third preliminary operation to set the ramp speed.(ISEG_RAMP_SPEED_SET.vi). The default ramp speed is of the order of 10V/s which is too slow for an example application. For ranges and resolution values please refer to the ISEG Operator Manual (or below to ISEG_DATA2VAL.vi description.) Altough all the channels can be switched on and off individually the driver provides only vi’s which can do this for the entire module. The vi’s in charge with this are ISEG_MODULE_SET_OFF.vi & ISEG_MODULE_SET_ON.vi. The setting and reading of the tensions are single channel commands. These commands are performed by dedicated vi’s ISEG_1CH_SET_V.vi & ISEG_1CH_READ_V .vi which can be iterativelly called to set or read a module or a crate. http://www-wnt.gsi.de/shiptrap/Drivers/ISEG/ISEG_1CH_SET_V.html 5 01/31/10 Of course the last step of any application is to close the CAN connexion by ISEG_Close_CAN.vi. If the connexion is not properly closed you have to switch off and on the ISEG crate again to avoid network errors. Besides the command vi’s the driver contains some auxiliary ones used to format dataframes and/or values: - ISEG_MOD2AID.vi Converts the module address and the data direction read/write into a valid arbitration ID. - ISEG_SINGLECH_COM.vi This VI is formatting the given command and the channel number into a valid DATA_ID.(The majority of the single channel commands form the DATA_ID field as four bits designating the operation to be performed and the four left as the channel value ( 0..15).) - ISEG_VAL2DATA.vi The dataframes to be sent to the modules are module type dependent and value type dependent. This VI code the value on 16 bit function of the module and the value types. - ISEG_DATA2VAL.vi The read data from the ISEG module is coded on 16 bit with a resolution of Max_Value/Scalling factor. The scalling factor is 50000 for tension and ramp speed and 25000 for current. This VI converts the coresponding data frames into double values. - ISEG_DATA_RESOLUTION.vi calculates the data resolution function of the module type (EHQF005p,EHQF010p..)and the value type (tension, current, ramp sped). Remark: All the vi’s and almost all the controls are have standard LabVIEW help option. 6 01/31/10 2.2 Using the EXAMPLE1_SET_READ.vi. Step 1) Switch ON the ISEG crate; Step 2) Set the initial values : CAN Network Interface : Default Value CAN1 Baud Rate: Default Value 100000 Module: Default Value 0 Module Type: Default Value EHQF005_ Channels ON/OFF: Default Value OFF Step 3) Run the VI. Step 4) Set ON the channels and modify the tension values. Remarks : It is highly recommeded to keep the LabVIEW Help window open so you can read the controls descriptions. If the obtained values are the double or the triple of the ones you set probably you have choosen the wrong module type. You can only change the module number before you start running the VI. But a modification to include it in the main loop should take you some 30 “. 7