Structure alignment issues encountered using LabVIEW

Publisher:hzx312895379Latest update time:2015-10-26 Source: eefocusKeywords:LabVIEW Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The following structure is passed between LV and VC's WIN32 DLL.
typedef struct  npm_axis
{
   int  axis_select;
   int     sv;//initial speed
   int     v;//drive speed
   //int    acc;//linear acceleration
   //int    dec;//linear deceleration
   int    sacc;//s-curve acceleration interval
   int     sdec;//s-curve deceleration interval
   int    tacc;//acceleration time
   int    tdec;//deceleration time
   char     line_s;//acceleration mode    
   int limit_speed;//speed limit
   int    pos;//absolute
   int    dis;    //increment int
   center;
   //int    speed;//start command
} uAXIS;

As a result, the data below char are all wrong. The reason is found on the Internet: LV uses a byte alignment method, that is, the cluster of LV is stored without gaps, and the size of the space occupied is the sum of the space occupied by this element. Usually, the DLL uses integer alignment (related to the compiler).

You can change char to int to deal with emergencies. It is recommended to refer to the example of CALL DLL.VI in LV.

Structure alignment issues encountered using LabVIEW


Keywords:LabVIEW Reference address:Structure alignment issues encountered using LabVIEW

Previous article:Implementation methods of two check codes of Modbus protocol based on LabVIEW
Next article:Decoding Labview read and write binary file format

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号