Menu

Why does a BigInt of 023 appear when I use a PC to read the C or T section of 200 SMART?

dlyc
2024-01-09
2024-01-09
  • dlyc

    dlyc - 2024-01-09

    代码:`#include <iostream></iostream>

    include "snap7.h"

    include <vector></vector>

    using namespace std;

    TS7Client* MyClient;

    int a = 33;
    short b = 12;
    void SymplyGet()
    {
    MyClient = new TS7Client();
    MyClient->SetConnectionType(3);//对应 s7-200smart
    cout << MyClient->ConnectTo("192.168.2.1", 0, 1) << endl; //PLC的IP地址,机架号,插槽号

    //cout << MyClient->WriteArea(S7AreaMK, 0, 0, 4, S7WLByte, &a) << endl;
    cout << hex<<MyClient->ReadArea(S7AreaCT, 0, 8, 2, S7WLCounter, &b) << endl;
    

    }

    int main()
    {
    SymplyGet();
    return 0;
    }`

     

    Last edit: dlyc 2024-01-09
  • dlyc

    dlyc - 2024-01-09

    BigInt is 2300000

     

Log in to post a comment.