The Super PLC with 3 Serial Ports: T100MX+ |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
T100MX SPECIAL INPUTS AND OUTPUTS Besides typical ON/OFF type I/Os and Analog I/Os, some of the T100MX first 8 ON/OFF inputs can be configured as special inputs such as High Speed Counter, Interrupt and Pulse Measurement. Some of the first 8 outputs can also be configured as PWM and the stepper pulse-outputs, as follow:
1. Interfacing Stepper Motors
The T100MX built-in Stepper-Motor Controller generates the required number of "pulses" according to the defined acceleration and maximum pulsing rate specified by "STEPSPEED" and STEPMOVE commands. The SETPSTOP command can immediately interrupt and stop the stepper motor. STEPCOUNT( ) function tracks the number of steps sent to the stepper motor since the beginning of STEPMOVE command. 2. PWM Outputs
Pulse-Width Modulation (PWM) is a highly efficient and convenient way of controlling output voltage to devices with large time constant, such as controlling the speed of a DC motor, the power to a heating element or the position of a proportional valve. PWM works by first turning the output to full voltage for a short while and then shutting it off for another short while and then turn it on again and so on in accurate time intervals. This can be illustrated in the following diagram:
The TBASIC SETPWM statement controls the frequency and duty-cycle settings of the PWM channel. The T100MX PLC features two channels of PWM on its outputs #7 and #8. Since these two outputs are high voltage, high current outputs (24V, 1A) they can be used to directly control the speed of a small DC motor of up to maximum of 1A current. They can also directly drive proportional (variable position) valves whose opening is dependent on the applied voltage. The advantage of using PWM is that you can easily amplify the drive current to a larger load such as larger permanent magnet DC motor by using low cost DC Solid-State Relays (SSR) to boost the current switching capability. In such case the T100MX PWM output is only used to drive the emitter portion of the SSR. The load is driven by the receiver portion of the SSR. Using SSR has the added advantage of isolating the CPU from the high current load. 3. High Speed Counter Inputs - Interfacing to Rotary Encoder
Input #3, 4 and Inputs #5, 6 form two channels of high speed counter inputs which can interface directly to a rotary encoder that produces quadrature outputs. A quadrature encoder produces two pulse trains at 90o phase shift from each as follow:
T100MX handles the quadrature signals as follow: if the pulse train arriving at input #3 leads the pulse train at input #4, the High Speed Counter (HSC) #1 increments on every pulse. If the pulse train arriving at input #3 lags the pulse trains at input #4, then the HSC #1 decrements. Note that if input #4 is OFF, then pulse trains arriving at input #3 is considered to lead the input #4 and HSC #1 will be incremented. Likewise if input #3 is OFF, then pulse trains arriving at input #4 will decrement HSC #1. Input #5 and #6 form the inputs for High Speed Counter channel #2 and they operate in the same way as Input#3 and #4 for HSC#1 described above. The fact that T100MX PLC automatically takes care of the direction of rotation of the quadrature encoder greatly simplifies the programmer's task of handling high speed encoder feedback. The HSCDEF statement can be used to define a Cusfn to be executed when the HSC reaches a certain pre-defined value. Within this Cusfn you can define the action to be taken and define the next Cusfn to be executed when the HSC reaches another value. 4. Interrupt Inputs An interrupt input may occur randomly and the CPU will have to immediately put down whatever it is doing and start servicing the interrupt. Hence the CPU responds much faster to an interrupt input. In addition, interrupts are edge-triggered, meaning that the interrupt condition occurs when the input either changes from ON to OFF or from OFF to ON. Consequently, the input logic state need not persist for longer than the logic scan time for it to be recognized by the CPU. Any one or all of inputs #3 to #7 can be used as interrupt inputs when defined by the INTDEF statement. The Interrupt inputs may also be defined as either rising-edge triggered (input goes from OFF to ON) or falling-edge triggered (input goes from ON to OFF). When the defined edges occur, the defined Custom Function (CusFn) will be immediately executed irrespective of the current state of execution of the ladder program. 5. Using Pulse Measurement Inputs T100MX provides a very straight forward means to measure the pulse width or frequency of a square-wave pulse-train arriving at its Pulse Measurement (PM) inputs #3 or #4. To use the input to measure pulse width or frequency, execute the PMON statement to configure the relevant input to become a pulse measurement input. Thereafter the pulse width (in ms) or the pulse frequency (in Hz) can be easily obtained from the PULSEWIDTH(n) or PULSEFREQUENCY(n) function.
©
Copyright 2001 Triangle Research International, Inc |