34

 
ID:1234567890 Start: 2016-09-08 09:28:15 End: 2016-09-08 09:30:00 LDmain300: 1608001/H2PAD_01/201608001.1-20160820101518 5%H2 10g/y 30g/y P01/05 1g/y P02/05 2g/y P03/05 3g/y P04/05 4g/y P05/05 5g/y Total 15g/y Passed 


public MainFrm() { InitializeComponent(); }

 

 

            byte[] SendByte = new byte[5];//数组定义
            SendByte[0] = 1;
            SendByte[1] = 2;
            SendByte[2] = 3;
            SendByte[3] = 4;
            SendByte[4] = 5;
            serialPort1.Open();  //打开串口
            serialPort1.Close(); //关闭串口
            serialPort1.Write(SendByte, 0, 5);//发送16进制
            serialPort1.WriteLine("字符串发送");//字符串发送


/*Information data*/
MODBUS_REG_LINE const	CPS_403X_regs_input_INFO[] = {
    /*Address   count   Name                Gain    NUM/STR     Unit        Report*/
    {0x0000,    1,      CPS_DEV_TYPE,       1,      UDEC,       /*"",     */true},	/**/
    {0x0001,    1,      "BootVer",          1,      UDEC,       /*"",     */true},	/**/
    {0x0002,    1,      "Config",           1,      UDEC,       /*"",     */true},	/**/
    {0x0003,    1,      CPS_REG_NUM,        1,      UDEC,       /*"",     */true},	/**/
    {0x0004,    1,      CPS_PRO_VER,        100,    UDEC,       /*"",     */true},	/**/
    {0x0005,    1,      CPS_MIN_VER,        100,    UDEC,       /*"",     */false},	/**/
    {0x0006,    4,      ZE_KEY_DEV_SN,      1,      BCD_STR,    /*"",     */false},	/**/
    {0x000A,    10,     ZE_KEY_DEV_MODEL,   1,      STR,        /*"",     */false},	/**/
    {0x0014,    1,      "RWNum",            1,      UDEC,       /*"",     */true},	/**/
    {0x0015,    1,      "RWAddr",           1,      UDEC,       /*"",     */true},	/**/
};

/*Business data*/
MODBUS_REG_LINE const	CPS_403X_regs_input_BIZ[] = {
/*Index  Address   count    Name                Gain    NUM/STR     Unit        Report*/
/* 0*/  {0x0016,    2,      "TYield",           1,      UDEC,       /*"kWh",  */true},	/*	Total energy to grid	*/
/* 1*/  {0x0018,    1,      "DYield",           10,     UDEC,       /*"kWh",  */true},	/*	The accumulated kWh of that day	*/
/* Note:The "Eff"'s Gain is changed from 100 to 10 at 2018.04.19 */
/* 2*/  {0x0019,    1,      "Eff",              10,     UDEC,       /*"%",    */true},	/*	Inverter efficiency. When reading this register is 0x1F40, representing Eff=0x1F40 *0.0001=0.8=80%	*/
/* 3*/  {0x001A,    1,      "PF",               1000,   SDEC,       /*"",     */true},	/*	Power factor. When reading this register is 0x0320, representing PF=0x0320 *0.001=0.8	*/
/* 4*/  {0x001B,    1,      "Pmax",             10,     UDEC,       /*"kW",   */true},	/*	AC maximum active power of that day	*/
/* 5*/  {0x001C,    1,      "RunT",             10,	    UDEC,       /*"Min",  */true},	/*	Number of time the Inverter starts feeding to the grid	*/
/* 6*/  {0x001D,    1,      "Pac",              10,	    UDEC,       /*"kW",   */true},	/*	AC active power 	*/
/* 7*/  {0x001E,    1,      "Sac",              10,	    UDEC,       /*"kVA",  */true},	/*	AC Apparent power 	*/
/* 8*/  {0x001F,    1,      "Uab",              10,	    UDEC,       /*"V",    */true},	/*	Grid voltage Uab	*/
/* 9*/  {0x0020,    1,      "Ubc",              10,	    UDEC,       /*"V",    */true},	/*	Grid voltage Ubc	*/
/*10*/  {0x0021,    1,      "Uca",              10,	    UDEC,       /*"V",    */true},	/*	Grid voltage Uca	*/
/*11*/  {0x0022,    1,      "Ia",               10,	    UDEC,       /*"A",    */true},	/*	Grid A phase current	*/
/*12*/  {0x0023,    1,      "Ib",               10,	    UDEC,       /*"A",    */true},	/*	Grid B phase current	*/
/*13*/  {0x0024,    1,      "Ic",               10,	    UDEC,       /*"A",    */true},	/*	Grid C phase current	*/
/*14*/  {0x0025,    1,      "Upv1",             10,	    UDEC,       /*"V",    */true},	/*	PV voltage	*/
/*15*/  {0x0026,    1,      "Ipv1",             10,	    SDEC,       /*"A",    */true},	/*	PV current	*/
/*16*/  {0x0027,    1,      "Upv2",             10,	    UDEC,       /*"V",    */true},	/*	PV2 voltage	*/
/*17*/  {0x0028,    1,      "Ipv2",             10,	    SDEC,       /*"A",    */true},	/*	PV2 current	*/
/*18*/  {0x0029,    1,      "Upv3",             10,	    UDEC,       /*"V",    */true},	/*	PV3 voltage	*/
/*19*/  {0x002A,    1,      "Ipv3",             10,	    SDEC,       /*"A",    */true},	/*	PV3 current	*/
/*20*/  {0x002B,    1,      "Freq",             10,	    UDEC,       /*"Hz",   */true},	/*	Grid frequency	*/
/*21*/  {0x002C,    1,      "Tmod",             10,	    SDEC,       /*"C",    */true},	/*	Heatsink temperature	*/
/*22*/  {0x002D,    1,      "Tamb",             10,	    SDEC,       /*"C",    */true},	/*	Ambient temperature	*/
/*23*/  {0x002E,    1,      "Tcoil",            10,	    SDEC,       /*"C",    */true},	/*	Transformer temperature	*/
/*24*/  {0x002F,    1,      CPS_MODE,           1,	    UDEC,       /*"",     */true},	/*	Inverter mode code, for detail see "Table5 Inverter Work Mode Descriptor"	*/
/*25*/  {0x0030,    4,      CPS_ERR_TIME,       1,	    BCD_STR,    /*"",     */false},	/*	Error timestamp(yyyy-mm-dd-hh-mm-ss-NULL) of model 0,eg.0x2012071615181000=2012-7-16 15:18:10	*/
/*26*/  {0x0034,    1,      CPS_PFAULT,         1,	    HEX,        /*"",     */false},	/*	permanent fautl code of model 0,for detail see " Table6 Inverter Events Descriptor"	*/
/*27*/  {0x0035,    1,      "Warn",             1,	    HEX,        /*"",     */false},	/*	warn code of model 0,for detail see " Table6 Inverter Events Descriptor"	*/
/*28*/  {0x0036,    1,      "Fault0",           1,	    HEX,        /*"",     */false},	/*	fautl code0 of model 0	*/
/*29*/  {0x0037,    1,      "Fault1",           1,	    HEX,        /*"",     */false},	/*	fautl code1 of model 0	*/
/*30*/  {0x0038,    1,      "Fault2",           1,	    HEX,        /*"",     */false},	/*	fautl code2 of model 0	*/
/*31*/  {0x0039,    1,      "Fault3",           1,      HEX,        /*"",     */false},	/*	fautl code3of model 0	*/
/*32*/  {0x003A,    1,      "Fault4",           1,      HEX,        /*"",     */false},	/*	fautl code4 of model 0	*/
/*33*/  {0x003B,    1,      "Qac",              10,     SDEC,       /*"kVA",  */true},	/*	AC ractive power 	*/
/*34*/  {0x003C,    1,      "PIDboxEn",         1,      UDEC,       /*"",     */false},	/*		*/
/*35*/  {0x003D,    1,      "PIDboxU",          1,	    UDEC,       /*"",     */false},	/*		*/
/*36*/  {0x003E,    1,      "PIDboxI",          1,	    UDEC,       /*"",     */false},	/*		*/
/*37*/  {0x003F,    1,      "Ref1",             1,	    UDEC,       /*"",     */false},	/*		*/
/*38*/  {0x0040,    1,      "Ref2",             1,	    UDEC,       /*"",     */false},	/*		*/
/*39*/  {0x0041,    1,      CPS_MAJOR_VER,      1,      UDEC,       /*"",     */false},	/*		*/
/*40*/  {0x0042,    1,      "PvD",              1,      UDEC,       /*"",     */true },	/*		*/
/*41*/  {0x0043,    1,      "BCap",             1,      SDEC,       /*"uF",   */true},
/*42*/  {0x0044,    1,      "AcCap",            1,      SDEC,       /*"uF",   */true},
/*43*/  {0x0045,    1,      "Pdc",              10,     UDEC,       /*"kW",   */false},
        /**************** Following registers is added from LCD V9.0***************/
/*44*/  {0x0046,    1,      "PwrMax",           1,      UDEC,       /*"kW",   */true},
        {0x0047,    1,      "Smax",             1,      UDEC,       /*"KVA",  */true},
        {0x0048,    1,      "Saf",              1,      UDEC,       /*"",     */false},

 

        //串口接收事件,相当于单片机串口接收中断
        private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            //字符串方式读
            string str = serialPort1.ReadExisting();//字符串方式读
            //16进制读
            int n = serialPort1.BytesToRead;   //获取缓冲区中的字节数
            byte[] Buf = new byte[n];          //定义一个以有效字节数为大小的缓存
            serialPort1.Read(Buf, 0, n);       //读取至缓存 
        }

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值