自动化立体仓库 - WCS系统
#
luxiaotao1123
2020-08-05 7bb6bff9506d1b0153b814e45f622c4f8538f67c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.zy.common.HslCommunication.Profinet.Melsec;
 
/**
 * 三菱PLC的数据类型,此处包含了几个常用的类型
 */
public class MelsecA1EDataType {
    /**
     * 如果您清楚类型代号,可以根据值进行扩展
     * @param code 数据类型的代号
     * @param type 0或1,默认为0
     * @param asciiCode ASCII格式的类型信息
     * @param fromBase >指示地址的多少进制的,10或是16
     */
    public MelsecA1EDataType( byte[] code, byte type, String asciiCode, int fromBase )
    {
        DataCode = code;
        AsciiCode = asciiCode;
        FromBase = fromBase;
        if (type < 2) DataType = type;
    }
 
    private byte[] DataCode = new byte[2];
    private byte DataType = 0x00;
    private String AsciiCode = "";
    private int FromBase = 0;
 
    /**
     * 类型的代号值(软元件代码,用于区分软元件类型,如:D,R)
     * @return
     */
    public byte[] getDataCode(){
        return DataCode;
    }
 
    /**
     * 数据的类型,0代表按字,1代表按位
     * @return
     */
    public byte getDataType(){
        return DataType;
    }
 
    /**
     * 当以ASCII格式通讯时的类型描述
     * @return
     */
    public String getAsciiCode(){
        return AsciiCode;
    }
 
    /**
     * 指示地址是10进制,还是16进制的
     * @return
     */
    public int getFromBase(){
        return FromBase;
    }
 
 
    /**
     * X输入寄存器
     */
    public final static MelsecA1EDataType X = new MelsecA1EDataType( new byte[] {0x58, 0x20}, (byte) 0x01, "X*", 8 );
 
    /**
     * Y输出寄存器
     */
    public final static MelsecA1EDataType Y = new MelsecA1EDataType( new byte[] {0x59,0x20}, (byte)0x01, "Y*", 8 );
 
    /**
     * M中间寄存器
     */
    public final static MelsecA1EDataType M = new MelsecA1EDataType( new byte[] {0x4D,0x20}, (byte)0x01, "M*", 10 );
 
    /**
     * S状态寄存器
     */
    public final static MelsecA1EDataType S = new MelsecA1EDataType( new byte[] {0x53,0x20}, (byte)0x01, "S*", 10 );
 
    /**
     * D数据寄存器
     */
    public final static MelsecA1EDataType D = new MelsecA1EDataType( new byte[] {0x44,0x20}, (byte)0x00, "D*", 10 );
 
    /**
     * R文件寄存器
     */
    public final static MelsecA1EDataType R = new MelsecA1EDataType( new byte[] { 0x52, 0x20 }, (byte)0x00, "R*", 10 );
}