ADwin Typographical Conventions Typographical Conventions "Warning" stands for information, which indicate damages of hardware or soft- ware, test setup or injury to persons caused by incorrect handling. You find a "note" next to – information, which absolutely have to be considered in order to guaran- tee an error free operation.
Page 6
ADwin Typographical Conventions ADwin-Gold USB / ENET, manual version 4.3, January 2012...
ADwin Information about this Manual 1 Information about this Manual This manual contains complex information about the operation of the ADwin-Gold sys- tem. Additional information are available in – the manual "ADwin Installation", which describes all interface installations for the ADwin systems.
ADwin System description 2 System description ADwin system concept ADwin systems guarantee fast and accurate operation of measurement data acquisi- tion and automation tasks under real-time conditions. This offers an ideal basis for appli- cations such as: – very fast digital closed-loop control systems –...
ADwin System description Communication between ADwin system and PC The ADwin system is connected to the PC via an USB or Ethernet interface. After Interfaces power-up the ADwin system is booted from the PC via this interface. Afterwards the ADwin operating system is waiting for instructions from the PC which it will process. There are two kinds of instructions: On the one hand instructions, which transfer data Instruction processing from the PC to the ADwin system, for instance "load process", "start process"...
ADwin System description The ADwin-Gold System Processor and memory The ADwin-Gold system is equipped with the digital 32 bit signal processor T9 (SHARC ADSP 21062) from Analog Devices with floating point and integer processing. It is responsible for the complete measurement data acquisition, online processing, and sig- nal output, and makes it possible to process instantaneously sample rates of up to sev- eral 100 kHz.
Page 11
ADwin System description The standard delivery items for the ADwin-Gold system: Standard delivery – the ADwin-Gold system with USB or Ethernet interface, – a USB cable or a cross-over Ethernet cable from the PC to the Gold device (length about 1.8m). –...
ADwin Operating Environment 3 Operating Environment The ADwin-Gold electronic is installed in a closed aluminum enclosure and it is only allowed to operate it in this enclosure. With the necessary accessories the system can be operated in 19-inch-enclosures or as a mobile system (e.g. in cars). See also chapter 2.2.2 "Accessories").
ADwin Initialization of the Hardware 4 Initialization of the Hardware If you start initializing do not connect any cables to the ADwin-Gold before you have executed the following steps: – Carry out completely the installation of the drivers and the power supply at the computer or notebook (see manual: "ADwin Driver Installation").
Page 14
ADwin Initialization of the Hardware The flashing LED (green colored now) and the display in the status line: "ADwin is booted" show that the operating system has been loaded and ADbasic can connect the ADwin system. (If not, please check the connectors first). Programs with ADbasic Programming the ADwin systems is described more detailed in the ADbasic manual.
ADwin Inputs and Outputs 5 Inputs and Outputs All inputs and outputs may only be operated according to the specifications given (see Connectors Annex A.1 Technical Data). In case of doubt, ask the manufacturer of the device, to which you want to connect the ADwin-Gold system. Open-ended inputs can cause errors - above all in an environment where interferences may occur.
ADwin Inputs and Outputs analog additional inputs/outputs inputs/outputs ANALOG OUT CAN 1.1 ANALOG IN CAN 1.2 CO POWER IN CAN 2 ADwin- Gold DIO 00-15 (IN) COM1 POWER DIO 16-31 (OUT) COM2 digital GND/PE power- ENET inputs/outputs connector supply connector Fig.
ADwin Inputs and Outputs The inputs are equipped with male BNC-plugs, which are arranged in 2 rows; the Gold- D option has the inputs connected to the DSub-connector ANALOG IN. At the BNC- plugs, the positive input is the inner conductor, the negative input is the outer conductor. ANALOG IN Fig.
ADwin Inputs and Outputs ANALOG OUT Additional outputs see chapter 7 "DA Add-On". DAC instruction The standard instruction (see page 45) checks each of the val- DAC(number, value) ues if it exceeds or falls below of the 16-bit value range (0...65535). If the value is in the 16-bit value range, the indicated value is output on the output number.
ADwin Inputs and Outputs ADwin-Gold has a programmable gain (PGA), with which you can amplify the input volt- Gain factor k age by the factors 1, 2, 4, and 8. At the same time the measurement range gets smaller by the corresponding gain factor k (see Annex "Technical Data").
ADwin Inputs and Outputs CONN. 1 CONN. 2 (male) DIO 00-15 DIO 16-31 DIO-00…DIO-15 DIO-16…DIO-31 Fig. 10 – Pin assignment digital IOs The digital inputs are TTL-compatible and not protected against over voltage. Do not use pins marked as "reserved". They are planned for changes and expansions and can cause damages to your system if you do not pay attention to this fact.
Page 21
ADwin Inputs and Outputs SET_MUX() … 'wait for settling of the 'multiplexer START_CONV() WAIT_EOC() 'wait for end of conversion READADC() 'or READADC12() at ADC12() You can use (or extend) the waiting times caused by the standard instructions for other Program structure purposes.
ADwin Inputs and Outputs CONF_DIO DIO31:24 DIO23:16 DIO15:08 DIO07:00 Configuration "IN" Instruction is At configuration "OUT" the register applicable for Configuration "OUT" contents of this byte is returned DIOnn, at Fig. 11 – Overview of the configuration with CONF_DIO Please pay attention to the following restriction: Only if the inputs/outputs are configured with (see pin assignmenton CONF_DIO(12)
ADwin Calibration 6 Calibration General Information The 2 digital-to-analog (DAC, optional 8) and the 4 analog-to-digital (ADC) converters of the ADwin-Gold systems have been calibrated in factory. In accordance with the reg- ulations for keeping the measurement accuracy in your field of application, the systems must be calibrated in regular time intervals.
Page 24
ADwin Calibration The upper field shows the current measurement values at the inputs IN1 and IN2, mea- sured each by the 16-bit and the 14-bit ADC. Select in the lower field left the DAC which you wish to calibrate and at right the ADC. The measurement value at the selected ADC is highlighted.
Page 25
ADwin Calibration Please note Fig. 4 "Schematic of ADwin-Gold (USB version)". Select "Next Step >>". 2. Setting the offset Adjust the offset value at the scrollbar in Set your voltage source to 0 V.The set- such a manner that your digital multim- ting of the ADC to this value is made eter displays -10 V.
Page 26
ADwin Calibration The program outputs the values 0...65535 digits on both DACs, compares them to the measured input values and displays the deviation in graphs. The deviation should be less than 5 digits. With Close you return to the overview window. Step 4 With "Print Calibration"...
ADwin DA Add-On 7 DA Add-On With the DA add-on you have 8 analog outputs in total with a resolution of 16 bit (and Connectors a DAC each). In the standard version two of these outputs go from DAC 3 and DAC 4 to the BNC plugs OUT 3 and OUT 4.
ADwin CO1 Counter Add-On 8 CO1 Counter Add-On The counter add-on Gold-CO1 (ordering option) has four 32-bit up/down counters with four-edge-evaluation. The technical data of the counter add-on CO1 is described in the annex A.1. Hardware The counter add-on Gold-CO1 has four 32-bit up/down counters with four-edge-evalu- ation.
ADwin CO1 Counter Add-On At the inputs A/CLK, B/DIR and CLR/LATCH TTL-alike signals are necessary. More details and limit values can be found in the "Technical Data". CONN. 1 CONN. 2 (male) DIO 00-15 DIO 16-31 Counter inputs with TTL operation mode for Gold / Gold-D (single-ended;...
ADwin CO1 Counter Add-On CO POWER IN (female) Fig. 15 – Pin assignment counter voltage supply (Gold-D) Software The functions necessary for accessing the counters can be found in the include file: <ADwGCnt.INC> Therefore programming has to start with the include file, so that you can use the instruc- tions in the following table.
ADwin CO1 Counter Add-On 8.2.1 Evaluation of the Counter Contents The binary counters of the CO1 add-on generate 32-bit values, which are interpreted by ADbasic as numerical values according to the model of the circle below: The most sig- nificant bit (MSB) is interpreted as a sign, the highest positive number (231-1) follows the highest negative number (-231) and the lowest positive number (0) follows the highest negative number (-1).
ADwin CO1 Counter Add-On 8.3.1 Clock and Direction 32 bit Latch A Data 32 bit Counter Control Registers Data Fig. 18 – Block diagram of the CO1 add-on in the mode "clock and direction" Every positive edge of a square-wave signal at the CLK input (clock) is counted (incre- mented or decremented) up to a maximum frequency of 20 MHz.
ADwin CO1 Counter Add-On 32 bit Latch A Data 4-edge evaluation 32 bit Counter Control Registers Data Fig. 19 – Block diagram of the CO1 add-on in the mode "four edge evaluation" Please note: – The counter counts 4 edges in one cycle of the A/B signal. –...
ADwin CO1 Counter Add-On 8.4.1 Period Duration Measurement All four counters can execute period duration measurements. 32 bit Latch A LATCH Data ref.-CLK switch Divider ÷ 4 32 bit Counter 20 MHz to f switches of other counters Control Registers Data Fig.
ADwin CO1 Counter Add-On 32 bit Latch A LATCH Data ref.-CLK switch Divider ÷ 4 32 bit Counter 20 MHz to f switches of other counters 32 bit Latch B Data Control Registers Data Fig. 21 – Block diagram of the CO1 add-on mode "impulse width/pause duration"...
ADwin CAN add-on 9 CAN add-on The add-on Gold-CAN is equipped with several additional interfaces that are configured and operated individually: – 4 SSI decoders (page The decoders can be used for the connection of incremental encoders with SSI interface. All inputs are differential and designed for RS422/485 level (5V). The decoder inputs are located on the connectors CO1...CO4, where the inputs of the CO1 add-on can also be found.
ADwin CAN add-on SSI Decoder An incremental encoder with SSI interface can be connected to the decoders. The sig- nals are differential and have RS422/485 levels. The decoders either read out an individual value (on request) or they continously provide the current value.
ADwin CAN add-on Example: A conversion from Gray code into binary code is made with the routine below, which you Conversion of have programmed in the ADbasic process. Gray code REM PAR_1 = Gray value to be converted REM PAR_2 = Flag indicating a new Gray value REM PAR_9 = Result of the Gray-to-binary conversion AS LONG EVENT:...
ADwin CAN add-on CAN Interface The CAN interfaces 1 and 2 can be operated individually. Depending on your require- ments, you can order both interfaces either as high-speed or low-speed version. Switch- ing in operation is not possible. 9.2.1 Hardware Description The connections of the interfaces 1 and 2 are located on the 9-pin DSUB connector: –...
Page 40
ADwin CAN add-on 11 bit and 29 bit. The communication, that means the management of bus messages, is effected by 15 message objects. The registers are used for configuration and status display of the CAN controller. Here the bus speed and interrupt handling, etc. are set (see separate documentation "82527 ®...
ADwin CAN add-on Message ID ID of the message object …001b …010b …011b …100b 1 (…001b) 2 (…010b) 3 (…011b) 4 (…100b) x: Message is admitted 0: Message is not admitted In this example the comparison of bit 2 is responsible for the assignment of the mes- sages, because the bits 3...10 of the compared identifiers are identical (= 0) and the bits 0 and 1 are not compared, because they are set to zero in the global mask (= not rele- vant).
Page 42
ADwin CAN add-on Both interfaces can be operated individually with the RS232 or RS485 protocol. The physical difference between the protocols is the level of the signals, which are gener- ated by special driver components on the bus. Pin assignment COM1, COM2 COM1, COM2 (RS232)
Page 44
ADwin CAN add-on Example programs RS232 The following program illustrates the initialization of the serial RS232 interface in the INIT: section and the cyclic reading and writing of data in the EVENT:. section. The process is timer-controlled: REM The program initializes the serial interface REM in the Init: section.
Page 45
ADwin CAN add-on In this example the RS485 interface is a passive participant, which reads data coming RS485 from the input. If a specified value (55) is received, the interface starts to send. It sends continuously the value 44. REM Interface 2 reads all data coming from the bus REM until it receives the value 55.
Page 46
ADwin CAN add-on ADwin-Gold USB / ENET, manual version 4.3, January 2012...
ADwin ADwin-Gold-Boot 10 ADwin-Gold-Boot This option is only available in an ADwin-Gold-ENET. ADwin-Gold-Boot starts a previously programmed application automatically after power-up. After installation of this application an operation without computer is possible. With ADwin-Gold-Boot the following steps are executed after power-up: –...
ADwin Accessories 11 Accessories The following accessories are available for the ADwin-Gold: – ADwin-Gold-pow: external 12V power supply unit (necessary for notebook operation). On the secondary side ADwin-Gold-pow provides 12 Volt at a maximum load of 2 Ampere. The power supply unit is rated for the highest load and maximum expansions of the ADwin-Gold.
ADwin Software 12 Software You are programming ADwin-Gold - all add-ons included - with simple ADbasic instruc- tions. Basic instructions are described in the ADbasic manual. Instructions for access of inputs / outputs and interfaces be found on following pages: –...
ADwin Analog Inputs and Outputs 12.1 Analog Inputs and Outputs This section describes the following instructions: – DAC (page – ADC (page – ADC12 (page – ReadADC (page – ReadADC12 (page – Set_Mux (page – Start_Conv (page – Wait_EOC (page ADwin-Gold USB / ENET, manual version 4.3, January 2012...
Page 51
ADwin Analog Inputs and Outputs outputs a defined voltage on a specified analog output. Syntax DAC(dac_no,value) Parameters Number of the analog output (1…8). dac_no LONG Value in digits, which defines the voltage to be LONG output (0…65535). Notes If you specify beyond the permissible value range, it will auto- value matically be set to the system-specific minimum or maximum value.
Page 52
ADwin Analog Inputs and Outputs measures the voltage of an analog input and returns the corresponding digital value. If specified, the return value is multiplied by a gain factor. For the 12-/14-bit converter use the instruction ADC12. Syntax ret_val = ADC(channel{,gain}) Parameters Number (1…16) of the analog input channel.
Page 53
ADwin Analog Inputs and Outputs With the following formula you can calculate the measured voltage from the returned digital value. measurement range ⋅ ---------------------------------------------- – Voltage Digits 32768 bipolar 65536 The following values, shown in the table below, apply in case you have chosen a gain of 1 (measurement range of 20 Volt): Return value of Measurement...
Page 54
ADwin Analog Inputs and Outputs ADC12 ADC12 measures the voltage of an analog input via 12-bit (rev. A) or 14-bit con- ADC12 verter (rev. B). The measurement value is returned in digits, multiplied by a gain factor if spec- ified. For the 16-bit converter use the instruction ADC.
Page 55
ADwin Analog Inputs and Outputs ADC12 With the following formula you can calculate the measured voltage from the returned digital value: measurement range ⋅ ---------------------------------------------- – Voltage Digits 32768 bipolar 65536 The following values, shown in the table below, apply in case you have chosen a gain of 1 (measurement range of 20 Volt): Return value of ADC12...
Page 56
ADwin Analog Inputs and Outputs ReadADC ReadADC returns a converted value from a 16-bit A/D-converter. READADC Syntax ret_val = ReadADC(adc_no) Parameters Number (1, 2) of the 16-bit converter to read. adc_no LONG Measurement value in digits which corresponds to LONG ret_val the voltage at the converter’s input.
Page 57
ADwin Analog Inputs and Outputs ReadADC12 ReadADC12 returns a converted value from one of the two 12-bit/14-bit A/D READADC12 converters. Syntax ret_val = ReadADC12(adc_no) Parameters Number (1, 2) of the 12-bit converter adc_no LONG to read. Measurement value in digits, which corresponds ret_val LONG to the voltage at the converter’s input.
Page 58
ADwin Analog Inputs and Outputs Set_Mux Set_Mux sets one or more A/D input multiplexers and the corresponding gain SET_MUX for the specified measurement channel. Syntax Set_Mux(pattern) Parameters Bit pattern for the allocation of measurement pattern LONG channels and gain. PGA 2 PGA 1 MUX 2 MUX 1...
Page 59
ADwin Analog Inputs and Outputs Set_Mux As Long Event: Set_Mux(0111100010b)'Set multiplexer (s.a.) 'Wait here for the settling time of the multiplexer 'by inserting some instructions. Start_Conv(1) 'Start AD-conversion ADC1 Wait_EOC(1) 'Wait for end of conversion of ADC1 = ReadADC(1) 'Read value of ADC1 ADwin-Gold USB / ENET, manual version 4.3, January 2012...
Page 60
ADwin Analog Inputs and Outputs Start_Conv Start_Conv can start the conversion of one or more A/D converters as well START_CONV as of all the D/A converters. Syntax Start_Conv(pattern) Parameters Bit pattern that specifies which converters should pattern CONST be started (only bits 0…4 can be used): LONG 1: start conversion.
Page 61
ADwin Analog Inputs and Outputs Wait_EOC Wait_EOC waits for the end of the conversion cycle of a specified A/D-con- WAIT_EOC verter. Syntax Wait_EOC(pattern) Parameters Bit pattern that specifies which converters are to pattern CONST be waited for (only bits 0…4 can be used). LONG Bit no.
ADwin Digital Inputs and Outputs 12.2 Digital Inputs and Outputs This section describes the following instructions: – Clear_Digout (page – Conf_DIO (page – Digin (page – Digin_Word (page – Digout_Word (page – Set_Digout (page ADwin-Gold USB / ENET, manual version 4.3, January 2012...
Page 63
ADwin Digital Inputs and Outputs Clear_Digout Clear_Digout sets one of the digital outputs to 0 (TTL low). CLEAR_DIGOUT Syntax Clear_Digout(bit_no) Parameters Bit number (0…15) which specifies the output bit_no CONST (see table). LONG … bit_no Output DIO16 DIO17 … DIO30 DIO31 Notes accepts only constants as parameter.
Page 64
ADwin Digital Inputs and Outputs Conf_DIO Conf_DIO configures the 32 digital channels in groups of 8 as inputs or out- CONF_DIO puts. Syntax Conf_DIO(pattern) Parameters Bit pattern that configures the digital channels as pattern CONST inputs or outputs: LONG Bit=0: Channels as inputs. Bit=1: Channels as outputs.
Page 65
ADwin Digital Inputs and Outputs Digin Digin returns the value of one of the digital inputs DIO00…DIO15. DIGIN Syntax ret_val = Digin(channel_no) Parameters Number which specifies the input to be queried channel_n LONG (see table below). CONST 1: TTL-level high. LONG ret_val 0: TTL-level low.
Page 66
ADwin Digital Inputs and Outputs Digin_Word Digin_Word returns the values of all digital inputs at the same time. DIGIN_WORD Syntax ret_val = Digin_Word() Parameters Bit pattern that corresponds to the TTL-levels at ret_val LONG the digital inputs (see table). 1: TTL-level high . 0: TTL-level low .
Page 67
ADwin Digital Inputs and Outputs Digout_Word Digout_Word sets with a bit pattern all digital outputs to defined TTL-levels. DIGOUT_WORD Syntax Digout_Word(pattern) Parameters Bit pattern that corresponds to the TTL-levels at pattern LONG the digital outputs (see table). 1: Set to TTL-level high. 0: Set to TTL-level low.
Page 68
ADwin Digital Inputs and Outputs Digout_Word A program setting TTL-levels of channels DIO00 … DIO15, could be as follows: Init: Conf_DIO(1111b) 'configure all channels as outputs Event: (ADC(1) > 3000) Then 'value limit exceeded? Digout_Word_CONN1(0FFFh) 'set outputs 0…15 EndIf Digout_Word_CONN1(value) Poke(204001C0h,value) EndSub ADwin-Gold USB / ENET, manual version 4.3, January 2012...
Page 69
ADwin Digital Inputs and Outputs Set_Digout Set_Digout sets one of the digital outputs to 1 (TTL-level high). SET_DIGOUT Syntax Set_Digout(bit_no) Parameters Bit number (0…15) which specifies the output bit_no CONST (see table). LONG … … bit_no Output in DIO16 DIO17 …...
Page 70
ADwin Digital Inputs and Outputs Set_Digout Example As Long Init: 'Configure digital inputs/output (ADwin-Gold only) Conf_DIO(1100b) Event: = ADC(1) 'Measurement data acquisition (val > 3000) Then Set_Digout(0) 'Set digital output DIO16 to 1 EndIf A subroutine which sets a single bit of the DIO-lines 0...15 to 1 could be as follows: SET_DIGOUT_CONN1(bitno) Poke(204001C0h, Peek(204001C0h)
Page 72
ADwin Counter Cnt_Clear Cnt_Clear sets one or more counters to zero, according to the bit pattern in Cnt_Clear pattern. Syntax #Include ADWGCNT.Inc Cnt_Clear(pattern) Parameters Bit pattern. LONG pattern Bit = 0: no influence. Bit = 1: set counter to zero. Bit no.
Page 73
ADwin Counter Cnt_Enable Cnt_Enable disables or enables the counters set by pattern, to count inco- Cnt_Enable ming impulses. Syntax #Include ADWGCNT.Inc Cnt_Enable(pattern) Parameters Bit pattern. LONG pattern Bit = 0: stop counter. Bit = 1: enable counter. Bit no. 31…4 C o u n t e r –...
Page 74
ADwin Counter Cnt_GetStatus Cnt_GetStatus reads out and returns the counter status register. Cnt_GetStatus Syntax #Include ADWGCNT.Inc ret_val = Cnt_GetStatus() Parameters Contents of the status register: In case of error, LONG ret_val refer to the table for the meaning of the individual bits.
Page 75
ADwin Counter Cnt_InputMode Cnt_InputMode sets the function of the CLR/LATCH input of one or more Cnt_InputMode counters. Syntax #Include ADWGCNT.Inc Cnt_InputMode(pattern) Parameters Bit pattern. LONG pattern Bit = 0: Set CLR-mode. Bit = 1: Set LATCH-mode. Bit no. 31…4 C o u n t e r –...
Page 76
ADwin Counter Cnt_Latch Cnt_Latch transfers the current counter values of one or more counters into Cnt_Latch the relevant Latch A, depending on the bit pattern in pattern. Syntax #Include ADWGCNT.Inc Cnt_Latch(pattern) Parameters Bit pattern. LONG pattern Bit = 0: no function. Bit = 1: transfer counter values into Latch A .
Page 78
ADwin Counter Cnt_Mode Cnt_Mode defines the operating mode of all counters by selecting which clock Cnt_Mode input they use according to the bit pattern in pattern. Syntax #Include ADWGCNT.Inc Cnt_Mode(pattern) Parameters Bit pattern. LONG pattern Bit = 0: external clock input (CLK/DIR or A/B). Bit = 1: internal clock input (5 MHz or 20 MHz).
Page 79
ADwin Counter Cnt_Read Cnt_Read transfers the current counter value into Latch A and returns it as Cnt_Read return value. Syntax #Include ADWGCNT.Inc ret_val = Cnt_Read(CounterNo) Parameters Counter number: 1…4. LONG CounterNo Counter value. LONG ret_val Notes Use the return value in calculations only with variables of the type Long (e.g.
Page 80
ADwin Counter Cnt_ReadLatch Cnt_ReadLatch returns the value of a counter previously stored in Latch A. Cnt_ReadLatch Syntax #Include ADWGCNT.Inc ret_val = Cnt_ReadLatch(CounterNo) Parameters Counter number: 1…4. LONG CounterNo Contents of Latch A . ret_val LONG Notes Use the return value in calculations only with variables of the type Long (e.g.
Page 81
ADwin Counter Cnt_ReadLatch Example #Include ADWGCNT.Inc rise, rise_old, fall, fall_old As Long #Define high Par_1 #Define Par_2 #Define Par_9 #Define Par_10 Init: rise_old 'Initialize the variables fall_old Cnt_SE_Diff(11b) 'All counter inputs differential Cnt_Mode(11b) 'Counters 1+2 on internal clock input Cnt_Set(0) 'All counters with 20 MHz internal 'reference clock...
Page 82
ADwin Counter Cnt_ReadFLatch Cnt_ReadFLatch returns the value of a counter previously stored in Latch B. Cnt_ReadFLatch Syntax #Include ADWGCNT.Inc ret_val = Cnt_ReadFLatch(CounterNo) Parameters Counter number: 1…4. LONG CounterNo Contents of Latch B. ret_val LONG Notes Use the return value in calculations only with variables of the type Long (e.g.
Page 83
ADwin Counter Cnt_ReadFLatch Example #Include ADWGCNT.Inc rise, rise_old, fall, fall_old As Long #Define high Par_1 #Define Par_2 #Define Par_9 #Define Par_10 Init: rise_old 'Initialize... fall_old ' the variables Cnt_SE_Diff(11b) 'All counter inputs differential Cnt_Mode(11b) 'Counters 1+2 on internal clock input Cnt_Set(0) 'All counters with 20 MHz internal...
Page 84
ADwin Counter Cnt_ResetStatus Cnt_ResetStatus clears the status register of all four 32 bit-counters. Cnt_ResetStatus Syntax #Include ADWGCNT.Inc Cnt_ResetStatus() Parameters - / - Notes The status register is read out with the instruction Cnt_GetStatus. See also Cnt_Clear, Cnt_Enable, Cnt_GetStatus, Cnt_InputMode, Cnt_Latch, Cnt_Mode, Cnt_Read, Cnt_ReadLatch, Cnt_ReadFLatch, Cnt_Set, Cnt_SE_Diff Valid for...
Page 85
ADwin Counter Cnt_ResetStatus Example #Include ADWGCNT.Inc error As Long old_1, new_1 As Long 'Dimensioning… old_2, new_2 As Long ' variables Init: Cnt_Enable(0) 'Stop all counters Cnt_Clear(1111b) 'Clear all counters Cnt_SE_Diff(11b) 'Set all counters to diff. inputs Cnt_Mode(0) 'Set external event input Cnt_Set(0) 'Set mode 4 edge evaluation Cnt_InputMode(0)
Page 86
ADwin Counter Cnt_Set Cnt_Set defines the operating mode for all counters (depending on Cnt_Set Cnt_Mode) according to the given bit pattern. Syntax #Include ADWGCNT.Inc Cnt_Set(pattern) Parameters Bit pattern, for the meaning of the bits see table LONG pattern below. Bit value External clock input Internal clock input Bit = 0 in...
Page 87
ADwin Counter Cnt_SE_Diff Cnt_SE_Diff sets counter inputs to the input mode single-ended or differen- Cnt_SE_Diff tial as pairs. Syntax #Include ADWGCNT.Inc Cnt_SE_Diff(CounterNo) Parameter Bit pattern to choose the counter pairs (see table) LONG CounterNo and set the input mode: Bit = 0: Run inputs single-ended. Bit = 1: Run inputs differential.
Page 88
ADwin Counter Cnt_SE_Diff Example #Include ADWGCNT.Inc error As Long 'Dimensioning… old_1, new_1 Long' variables old_2, new_2 As Long Init: Cnt_Enable(0) 'Stop all counters Cnt_Clear(1111b) 'Clear all counters Cnt_SE_Diff(11b) 'Set all counters to diff. inputs Cnt_Mode(0) 'Set external event input Cnt_Set(0) 'Set mode 4 edge evaluation Cnt_InputMode(0) 'Enable CLR counter input...
ADwin CAN interface 12.4 CAN interface This section describes the following instructions: – CAN_Msg (page – En_CAN_Interrupt (page – En_Receive (page – En_Transmit (page – Get_CAN_Reg (page – Init_CAN (page – Read_Msg (page – Read_Msg_Con (page – Set_CAN_Baudrate (page – Set_CAN_Reg (page –...
Page 90
ADwin CAN interface CAN_Msg CAN_Msg is a one-dimensional array of 9 elements, where CAN message CAN_Msg[] objects are stored. Syntax #Include ADWGCAN.Inc CAN_Msg[n] = value value = CAN_Msg[n] Parameters Element number in the array CAN_Msg (1…9). LONG Value (8 bit), which is to be written into or LONG value read from the message object.
Page 91
ADwin CAN interface CAN_Msg Example #Include ADWGCAN.Inc REM Sends a 32 Bit FLOAT-value (here: Pi) as sequence of REM 4 bytes in a message object REM (Receiving of a float value see Example at Read_Msg) #Define 3.14159265 As Long Init: Init_CAN(1) 'Initialize CAN controller 1 REM Enable message object 6 of controller 1 with the...
Page 92
ADwin CAN interface En_CAN_Interrupt En_CAN_Interrupt configures a specified message object of a CAN inter- EN_CAN_INTERRUPT face to generate an external event when a message arrives. Syntax #Include ADWGCAN.Inc En_CAN_Interrupt(can_no, msg_no) Parameters Number (1, 2) of CAN interface. LONG can_no Number (1…15) of message object. LONG msg_no Notes...
Page 93
ADwin CAN interface En_Receive En_Receive enables a specified message object of a CAN inteface to receive En_Receive messages. Syntax #Include ADWGCAN.Inc En_Receive(can_no, msg_no, id, id_extend) Parameters Number (1, 2) of CAN interface. LONG can_no Number (1…15) of message object. LONG msg_no Identifier (0…2 or 0…2...
Page 94
ADwin CAN interface En_Transmit En_Transmit enables a specified message object of a CAN inteface to send EN_Transmit messages. Syntax #Include ADWGCAN.Inc En_Transmit(can_no, msg_no, id, id_extend) Parameters Number (1, 2) of CAN interface. LONG can_no Number (1…14) of message object. LONG msg_no Identifier which is sent with the messages of this LONG...
Page 95
ADwin CAN interface Get_CAN_Reg Get_CAN_Reg reads the value of a specified register in one of the CAN con- GET_CAN_REG trollers. Syntax #Include ADWGCAN.Inc ret_val = Get_CAN_Reg(can_no, regno) Parameters Number (1, 2) of CAN interface. LONG can_no Register number in the CAN controller (0…255). LONG regno Contents of the register (transferred to the lower...
Page 96
ADwin CAN interface Init_CAN Init_CAN initializes one of the CAN controllers. Init_CAN Syntax #Include ADWGCAN.Inc Init_CAN(can_no) Parameters Number (1, 2) of CAN interface. LONG can_no Notes The instruction carries out the following steps: • Reset (hardware reset of the CAN controller) •...
Page 97
ADwin CAN interface Read_Msg Read_Msg checks if new messages have been received in a specified mes- Read_Msg sage object of CAN interface. If so, the message is saved in CAN_Msg and the identifier of the message is returned. Syntax #Include ADWGCAN.Inc ret_val = Read_Msg(can_no, msg_no)
Page 98
ADwin CAN interface Read_Msg Example #Include ADWGCAN.Inc REM If a new message with the correct identifier is received REM the data is read out. The first 4 bytes of the message are REM combined to a float value of length 32 bit. As Long Init: Par_1...
Page 99
ADwin CAN interface Read_Msg_Con Read_Msg_Con checks if a complete new message has been received in a Read_Msg_Con specified message object. If so, the message is saved in CAN_Msg and the identifier of the message is returned. Syntax #Include ADWGCAN.Inc ret_val = Read_Msg_Con(can_no, msg_no) Parameters Number (1, 2) of CAN interface.
Page 100
ADwin CAN interface Read_Msg_Con Example #Include ADWGCAN.Inc REM If a new message with the correct identifier is received REM the data is read out. The first 4 bytes of the message are REM combined to a float value of length 32 bit. As Long Init: Par_1...
Page 101
ADwin CAN interface Set_CAN_Baudrate Set_CAN_ sets the Baud rate of the specified CAN controller. Set_CAN_Baudrate Baudrate Syntax #Include ADWGCAN.Inc ret_val = Set_CAN_Baudrate(can_no, rate) Parameters Number (1, 2) of CAN interface. LONG can_no Baud rate in bits/second. rate FLOAT 0: Baud rate is set. ret_val LONG 1: Baud rate invalid.
Page 102
ADwin CAN interface Set_CAN_Reg Set_CAN_Reg writes a value into a specified register of one of the CAN con- Set_CAN_Reg trollers. Syntax #Include ADWGCAN.Inc Set_CAN_Reg(can_no, regno, value) Parameters Number (1, 2) of CAN interface. LONG can_no Register number in the CAN controller (0…255). LONG regno Value (8 bits), which is written into the register.
Page 103
ADwin CAN interface Transmit Transmit sends the message in CAN_Msg via the specified message object Transmit of a CAN controller. Syntax #Include ADWGCAN.Inc Transmit(can_no, msg_no) Parameters Number (1, 2) of CAN interface. LONG can_no Number (1…14) of message object. LONG msg_no Notes To send a message you have to follow the correct order:...
ADwin RSxxx interface 12.5 RSxxx interface This section describes the following instructions: – Check_Shift_Reg (page – Get_RS (page 100) – Read_FIFO (page 101) – RS485_Send (page 102) – RS_Init (page 103) – RS_Reset (page 105) – Set_RS (page 106) – Write_FIFO (page 107) ADwin-Gold USB / ENET, manual version 4.3, January 2012...
Page 105
ADwin RSxxx interface Check_Shift_Reg Check_Shift_Reg returns, if all data has been sent, which was written into CHECK_SHIFT_REG the send-FIFO of the RSxxx interface. Syntax #Include ADWGCAN.Inc ret_val = Check_Shift_Reg(interface) Parameters Number (1, 2) of RSxxx interface that is to be LONG interface read.
Page 106
ADwin RSxxx interface Get_RS Get_RS reads out a specified controller register. GET_RS Syntax #Include ADWGCAN.Inc ret_val = Get_RS(reg_addr) Parameters Address of the controller register to read. LONG reg_addr Contents of the controller register. ret_val LONG Notes We recommend to use this instruction only after you have more experi- ence about how the controller operates (data-sheet of the manufacturer: TL16C754 from Texas Instruments).
Page 107
ADwin RSxxx interface Read_FIFO Read_FIFO reads a value from the input FIFO of a specified RSxxx interface. READ_FIFO Syntax #Include ADWGCAN.Inc ret_val = Read_FIFO(interface) Parameters number (1, 2) of the RSxxx interface that is to be LONG interface read out. Contents of the input FIFO: LONG ret_val...
Page 108
ADwin RSxxx interface RS485_Send RS485_Send determines the transfer direction for a specified RSxxx interface. RS485_Send Syntax #Include ADWGCAN.Inc RS485_Send(interface,dir) Parameters RSxxx interface to be set (1, 2). LONG interface Tranfer direction of the RSxxx interface: LONG 0: Set RSxxx interface to receive. 1: Set RSxxx interface to send.
Page 109
ADwin RSxxx interface RS_Init RS_Init initializes one RSxxx interface. RS_INIT The following parameters are set: • Transfer rate in Baud • Use of test bits • Data length • Amount of stop bits • Transfer protocol (handshake) Syntax #Include ADWGCAN.Inc RS_Init(interface,baud,parity,bits,stop,handshake) Parameters Number of RSxxx interface (1, 2), which is to be...
Page 110
ADwin RSxxx interface RS_Init Example #Include ADWGCAN.Inc Init: RS_Reset() 'Reset RSxxx controller RS_Init(1,9600,0,8,0,1) 'Initialization of RSxxx interface 1 'with 9600 Baud, without parity, '8 data bits, 1 stop bit and 'hardware handshake. ADwin-Gold USB / ENET, manual version 4.3, January 2012...
Page 111
ADwin RSxxx interface RS_Reset RS_Reset executes a hardware reset and deletes the settings for all RSxxx RS_RESET interfaces. Syntax #Include ADWGCAN.Inc RS_Reset() Parameters - / - Notes sends a reset impulse to the input of the controller RS_Reset TL16C754. In the data-sheet of the controller 16C754 from Texas Instru- ments it is described, to which values the registers have been set after the hardware reset.
Page 112
ADwin RSxxx interface Set_RS Set_RS writes a value into a specified register of the controller. SET_RS Syntax #Include ADWGCAN.Inc Set_RS(reg_addr,value) Parameters Number of the register, into which data are written. LONG reg_addr Value to be written into the register. value LONG Notes We recommend to use this instruction only after you have more experi-...
Page 113
ADwin RSxxx interface Write_FIFO Write_FIFO writes a value into the send-FIFO of a specified RSxxx interface. WRITE_FIFO Syntax #Include ADWGCAN.Inc ret_val = Write_FIFO(interface,value) Parameters RSxxx interface number (1, 2) to whose send- LONG interface FIFO data are transferred. Value to be written into the send-FIFO. LONG value Status message:...
ADwin SSI interface 12.6 SSI interface This section describes the following instructions: – SSI_Mode (page 109) – SSI_Read (page 110) – SSI_Set_Bits (page 111) – SSI_Set_Clock (page 112) – SSI_Start (page 113) – SSI_Status (page 114) ADwin-Gold USB / ENET, manual version 4.3, January 2012...
Page 115
ADwin SSI interface SSI_Mode SSI_Mode sets the modes of all SSI decoders, either "single shot" (read out SSI_MODE once) or "continuous" (read out continuously). Syntax #Include ADWGCNT.Inc SSI_Mode(pattern) Parameters Operation mode of the SSI decoders, indicated as LONG pattern bit pattern. A bit is assigned to each of the decod- ers (see table).
Page 116
ADwin SSI interface SSI_Read SSI_Read returns the last saved counter value of a specified SSI counter. SSI_READ Syntax #Include ADWGCNT.Inc ret_val = SSI_Read(dcdr_no) Parameters Number (1…4) of the SSI decoder whose counter LONG dcdr_no value is to be read. Last counter value of the SSI counter (= absolute LONG ret_val value position of the encoder).
Page 117
ADwin SSI interface SSI_Set_Bits SSI_Set_Bits sets for an SSI counter the amount of bits which generate a SSI_SET_BITS complete encoder value. The number of bits should be equal to the resolution of the encoder. Syntax #Include ADWGCNT.Inc SSI_Set_Bits(dcdr_no,bit_count) Parameters Number (1…4) of the SSI decoder whose resolu- LONG dcdr_no tion is to be set.
Page 118
ADwin SSI interface SSI_Set_Clock SSI_Set_Clock sets the clock rate (approx. 40kHz to 1MHz) , with which the SSI_SET_CLOCK encoder is clocked. Syntax #Include ADWGCNT.Inc SSI_Set_Clock(dcdr_no,prescale) Parameters Number (1…4) of the SSI decoder whose clock LONG dcdr_no rate is to be set. Scale factor (10…255) for setting the clock rate LONG prescale...
Page 119
ADwin SSI interface SSI_Start SSI_Start starts the reading of one or both SSI encoders (only in mode "sin- SSI_START gle shot"). Syntax #Include ADWGCNT.Inc SSI_Start(pattern) Parameters Bit pattern for selecting the SSI decoders which LONG pattern are to be started: Bit = 0: No function.
Page 120
ADwin SSI interface SSI_Status SSI_Status returns the current read-status on the speicified module for a SSI_Status specified decoder. Syntax #Include ADWGCNT.Inc ret_val = SSI_Status(dcdr_no) Parameters Number (1…4) of the SSI decoder whose status is LONG dcdr_no to be queried. Read-status of the decoder: LONG ret_val 0: Decoder is ready, that is a complete value was...
ADwin Annex Technical Data Annex A.1 Technical Data All technical data refer to a powered-up ADwin-Gold system. General Data/Limit Values Symbol Conditions min. typ. max. Unit Supply Voltage/Supply Current Voltage =10V =12V Idle current, idle, USB USB Interface =35V =12V; Gold-DA =12V Power-up current, power-on, USB...
ADwin Annex Technical Data Digital Inputs/Outputs Parameters Symbol Conditions min. typ. max. Unit I/O-lines DIO00:DIO31 32 (programmable in groups of 8 as inputs or outputs) Number EVENT ext. trigger input (positive TTL logic) Inputs = 5V Max. input voltage -0.5 +5.5 (High) = 5V...
Page 123
ADwin Annex Technical Data Analog Inputs/Outputs Parameters Symbol Conditions min. typ. max. Unit Drift ±2 ppm/K Offset Error adjustable Drift ±5 ppm/K Gain Error adjustable ADC 16-bit Conversion time µs conv +9.999695 +4.999847 Measurement range -2.5 +2.499924 -1.25 +1.249962 Diff. common mode voltage ±2.5 Integral non-linearity ±1...
Page 124
ADwin Annex Technical Data CO1 Add-On Parameters Symbol Conditions min. typ. max. Unit Counter Number 4 counters (CNTR1 … CNTR4) For each counter 3 differential inputs (A/CLK, B/DIR, CLR/LATCH); counter inputs Inputs programmable in pairs for differential or TTL mode (single-ended) Counter resolution Input CLK Count frequency...
ADwin Annex Hardware Addresses - General Overview A.2 Hardware Addresses - General Overview Hardware addresses for ADCs Address Function Commentary [HEX] 31:16 15:10 9 8 7 6 5 4 3 2 1 0 ""nnn"" binary = 0...7 decimal, Set MUX 1: channels 1, 3, 5, …, 15 n n n selected ch.
Page 126
ADwin Annex Hardware Addresses - General Overview Hardware addresses for digital inputs / outputs Address Function Commentary [HEX] 31:16 15:10 9 8 7 6 5 4 3 2 1 0 204000B0 Input registers DIO15:00 x x x x x x x x x x x : digital value read in 204001B0 Input registers DIO31:16 x x x x x x x x x x...
ADwin Annex Hardware revisions A.3 Hardware revisions The revision of a Gold system is marked on the bottom of the casing. The differences of the revision status’ are shown below. First Revision Changes to previous revision status release 1998 First release with link data connection. Nov.
ADwin Annex Baudrates for the CAN bus A.5 Baudrates for the CAN bus ADwin-Gold-CAN provides CAN bus interfaces, version „high speed“. The following baudrates can be set: Available Baud rates [Bit/s] 1000000.0000 888888.8889 800000.0000 727272.7273 666666.6667 615384.6154 571428.5714 533333.3333 500000.0000 470588.2353 444444.4444 421052.6316...
Page 129
ADwin Annex Baudrates for the CAN bus Available Baud rates [Bit/s] 18140.5896 18099.5475 18018.0180 17857.1429 17777.7778 17738.3592 17582.4176 17543.8596 17429.1939 17391.3043 17316.0173 17241.3793 17204.3011 17094.0171 17021.2766 16949.1525 16913.3192 16842.1053 16806.7227 16771.4885 16666.6667 16632.0166 16563.1470 16528.9256 16460.9053 16393.4426 16326.5306 16260.1626 16227.1805 16194.3320 16161.6162 16129.0323...
Page 130
ADwin Annex Baudrates for the CAN bus Available Baud rates [Bit/s] 8230.4527 8205.1282 8196.7213 8163.2653 8130.0813 8113.5903 8105.3698 8097.1660 8088.9788 8080.8081 8064.5161 8000.0000 7976.0718 7944.3893 7936.5079 7905.1383 7843.1373 7812.5000 7804.8780 7797.2710 7774.5384 7751.9380 7736.9439 7729.4686 7714.5612 7692.3077 7662.8352 7655.5024 7619.0476 7590.1328 7575.7576 7561.4367...
Page 134
ADwin Annex Index resistance settling time, see also multiplexer internal of power supply unit · 11 see also revisions of hardware · 7 shielding · 6 RSxxx Software · 43 Check_Shift_Reg · 99 SSI decoder · 31 Get_RS · 100 SSI_...
Need help?
Do you have a question about the ADwin-Gold-USB and is the answer not in the manual?
Questions and answers