Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is cnc_rdparam() able on ubuntu64? #20

Open
lovedva opened this issue May 10, 2024 · 1 comment
Open

is cnc_rdparam() able on ubuntu64? #20

lovedva opened this issue May 10, 2024 · 1 comment

Comments

@lovedva
Copy link

lovedva commented May 10, 2024

It returns same random idata value(17208 or 17304 or 0) when parameter num is deferent.
Same code on win10 x64 is ok, seems "cnc_rdparam()" function has failed
Please help....

param.wrong.value.mp4
 unsigned short h; //定义句柄
    char str[] ="192.168.88.134"; //定义ip地址
    short ret; //连接函数返回值
    ODBST buf; //设备状态
    ODBEXEPRG exeprg; //执行文件名
    ODBSYS info;
    IODBPSD param ;
    short  paramnum=6712; //读取加工零件数p299 6711 6712
    //连接cnc
    ret=connectCNC(str,8193,10,&h);
    // ret = cnc_allclibhndl3( "192.168.88.128", 8193, 10, &h ) ; //VMWARE使用NAT模式连接成功,切换网络模式后需要重启模拟器
    if ( !ret ) {
            cnc_sysinfo( h, &info ) ; //获取系统信息
            cnc_statinfo( h, &buf ) ; //获取设备状态
            // cnc_exeprgname(h &exeprg); //获取文件名
            getExePrgname(h, &exeprg);
            cnc_rdparam( h, paramnum, -1 , (4+4*3), &param ) ;//读取加工零件数p299 
            printf("-----------------------------------\n");
            printf("connect success,hndl: %d\n",h);
            printf("cncrun status:%d\n",getCNCStatus(h,&buf));
            printf("executed file name: %s\n",exeprg.name); //没有执行是返回O0
            printf("-----------------------------------\n");
            printODBST(buf);
            printODBSYS(info); 
            printf( "read param %d ldata : %ld\n", paramnum,param.u.ldata ) ;
            printf( "read param %d  idata : %d\n", paramnum,param.u.idata ) ;
            printf( "read param %d  datano : %d\n", paramnum,param.datano ) ;
            printf( "read param %d  type : %d\n", paramnum,param.type ) ;
            // int idx;
            //  for ( idx = 0 ; idx < 32 ; idx++ ) {
            //      printf( "#%d\n", idx+1 ) ;
            //      printf( "%c\n", param.u.cdatas[idx] ) ;
            //  }
            //断开连接
            cnc_freelibhndl( h );

image

@Zzzyp0215
Copy link

我也遇到了这样的问题,请问有解决思路吗?是因为读取长度,或者是内存对齐等问题?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants