Esempio n. 1
0
        /// <summary>
        /// 获取指定地址的文数值
        /// </summary>
        /// <param name="pos"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public static string GetDString(int pos, int size)
        {
            StringBuilder str = new StringBuilder("", size);

            Class_ShareMem.Get_D_String(pos, str, size);
            return(str.ToString());
        }
        //Button控件click事件,切换前景颜色,需要两个标志位
        public static void Click_ChangeForeColor_Two_Address(Control control, int addressOn, int addressOff, Color oriColor, Color changeColor)
        {
            bool on  = Class_ShareMem.Get_M(addressOn) == 1;
            bool off = Class_ShareMem.Get_M(addressOff) == 1;

            if (on)
            {
                control.BackColor = changeColor;
                Class_ShareMem.Set_M(addressOn, false);
            }
            if (off)
            {
                control.BackColor = oriColor;
                Class_ShareMem.Set_M(addressOn, false);
            }
        }
        //Button控件click事件,切换背景图片,需要两个标志位
        public static void Click_ChangeBackgroundImage_Two_Address(Control control, int addressOn, int addressOff, Image oriImage, Image changeImage)
        {
            bool on  = Class_ShareMem.Get_M(addressOn) == 1;
            bool off = Class_ShareMem.Get_M(addressOff) == 1;

            if (on)
            {
                control.BackgroundImage = changeImage;
                Class_ShareMem.Set_M(addressOn, false);
            }
            if (off)
            {
                control.BackgroundImage = oriImage;
                Class_ShareMem.Set_M(addressOn, false);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 往W地址里面写入字符串
 /// </summary>
 /// <param name="pos"></param>
 /// <param name="value"></param>
 /// <param name="size"></param>
 public static void SetWString(int pos, string value, int size)
 {
     Class_ShareMem.Set_W_String(pos, value, size);
 }
Esempio n. 5
0
        /// <summary>
        ///GET_DX
        /// </summary>
        /// <param name="pos"></param>
        /// <param name="value"></param>
        public static bool GetDX(int port, int bit)
        {
            int value = Class_ShareMem.Get_DX(11, port, bit);

            return(value == 1 ? true : false);
        }
Esempio n. 6
0
 /// <summary>
 /// 往指定双字的D写值
 /// </summary>
 /// <param name="pos"></param>
 /// <param name="value"></param>
 public static void SetDoubleD(int pos, int value)
 {
     Class_ShareMem.Set_D(pos, value, true);
 }
Esempio n. 7
0
 /// <summary>
 /// 往指定单个字的W写值
 /// </summary>
 /// <param name="pos"></param>
 /// <param name="value"></param>
 public static void SetSingleW(int pos, int value)
 {
     Class_ShareMem.Set_W(pos, value, false);
 }
Esempio n. 8
0
 /// <summary>
 /// 获取双字的D
 /// </summary>
 /// <param name="pos"></param>
 /// <returns></returns>
 public static int GetDoubleD(int pos)
 {
     return(Class_ShareMem.Get_D(pos, true));
 }
Esempio n. 9
0
 /// <summary>
 /// 往指定单个字的W写值
 /// </summary>
 /// <param name="pos"></param>
 /// <param name="value"></param>
 public static int GetSingleW(int pos)
 {
     return(Class_ShareMem.Get_W(pos, false));
 }
Esempio n. 10
0
 /// <summary>
 /// 往指定M设假
 /// </summary>
 /// <param name="pos"></param>
 public static void BitOffM(int pos)
 {
     Class_ShareMem.Set_M(pos, false);
 }
Esempio n. 11
0
 /// <summary>
 /// 往指定M设真
 /// </summary>
 /// <param name="pos"></param>
 public static void BitOnM(int pos)
 {
     Class_ShareMem.Set_M(pos, true);
 }
Esempio n. 12
0
        /// <summary>
        /// 读取指定M地址
        /// </summary>
        /// <param name="pos"></param>
        /// <returns></returns>
        public static bool GetM(int pos)
        {
            int value = Class_ShareMem.Get_M(pos);

            return(value == 1 ? true : false);
        }
Esempio n. 13
0
 private void button2_Click(object sender, EventArgs e)
 {
     Class_ShareMem.Set_M(IMP_Address.M20000, true);
     Class_ShareMem.Set_M(IMP_Address.M10000, true);
 }
Esempio n. 14
0
 public Form1()
 {
     InitializeComponent();
     Class_ShareMem.ShareMem_Create();//0409
 }