LC switch output roughly divided into three types, relay output, transistor output type and triac output type. AC to DC relay outputs are transistor common with 5VDC and 24VDC output, SCR is relatively rare, and only special output models only. Considering the selection of the output module type.
2015年5月28日星期四
Analog sampling values transfer
MAX187 has an internal reference voltage, both 4 # pin (REF) is 4.096V, therefore, compact plc ,A / D conversion of the full range of 4.096V. The input signal is 0 ~ 5V, therefore, to add an op amp to 0 ~ 5V 0 ~ 4.096V after converted into MAX187. AT89C52 the P1.3 and chip select (CS) MAX187 connected, AT89C52 the P1.4 terminal and serial clock signal (SCLK) MAX187 is connected to the serial data output of AT89C52 the P1.5 and MAX187 (DOUT) connected. Value stored in the microcontroller memory analog sampling, plc analog input module and then by the microcontroller serial port to send to the PLC. A / D conversion of the C51 program is as follows,
#include
#include
sbit IC4_S = P1 ^ 4;
/ * AD input port settings * / sbit IC4_D = P1 ^ 5;
sbit IC4_C = P1 ^ 3;
void input (void)
{Unsigned char idata i;
unsigned int idata result = 0x0000;
IC4_C = 0;
/ * CS terminal is low * / for (i = 0; i <12; i ++)
{Result = result << 1;
IC4_S = 0; / * clock terminal generates a clock pulse * /
IC4_S = 1;
if (IC4_D) result ++;
/ * Read from the serial data output of the A / D conversion data * /}
IC4_C = 1; / * CS side is high * / pdat [1] = result;}
订阅:
博文评论 (Atom)
没有评论:
发表评论