Igi Posted August 9, 2016 Report Share Posted August 9, 2016 Hello, I'm trying to read values from a data table within a C function. I cannot find any examples. Could you show some examples? 1 Quote Link to comment Share on other sites More sharing options...
s.pratt Posted August 9, 2016 Report Share Posted August 9, 2016 Hello, I don't believe you can address the data table directly in the C function. You would have to perform a 'read row from DTI' to put the row information into a tag. Then pass this tag (which will be a struct) into your C function. It is important to note that when passing the struct into a subroutine, the struct will update with each scan since it is a passed in by reference. You will not have to pass the struct back out - it will be updated as it moves through the subroutine. Hope this helps. Quote Link to comment Share on other sites More sharing options...
Igi Posted August 9, 2016 Author Report Share Posted August 9, 2016 Hello, I don't believe you can address the data table directly in the C function. You would have to perform a 'read row from DTI' to put the row information into a tag. Then pass this tag (which will be a struct) into your C function. It is important to note that when passing the struct into a subroutine, the struct will update with each scan since it is a passed in by reference. You will not have to pass the struct back out - it will be updated as it moves through the subroutine. Hope this helps. Thank you, but it is possible to use directly DT, but in last version of Unistream you can choose type of input DT then in C code is automatically generated this structure: typedef struct { unsigned int BufferPointer; // BufferPointer unsigned int EntrySize; // EntrySize unsigned int Number_of_rows; // Number of rows unsigned int Signature; // Signature char Status; // Status char PadUInt[3]; // PadUInt } Data_Table_Indexed; // Data Table: Indexed but I do not know what to do with these members of the structure( I know C programming very well and I can work with structures etc.) . I mean how to get data from that. I tried to read from all, I tried to write one of them then read from the others etc..., but I have got just garbage values... Quote Link to comment Share on other sites More sharing options...
s.pratt Posted August 9, 2016 Report Share Posted August 9, 2016 Thank you, but it is possible to use directly DT, but in last version of Unistream you can choose type of input DT then in C code is automatically generated this structure: typedef struct { unsigned int BufferPointer; // BufferPointer unsigned int EntrySize; // EntrySize unsigned int Number_of_rows; // Number of rows unsigned int Signature; // Signature char Status; // Status char PadUInt[3]; // PadUInt } Data_Table_Indexed; // Data Table: Indexed but I do not know what to do with these members of the structure( I know C programming very well and I can work with structures etc.) . I mean how to get data from that. I tried to read from all, I tried to write one of them then read from the others etc..., but I have got just garbage values... Please e-mail into support@unitronics.com for more information on this topic. As far as I am aware, this type of input for a C function is only to configure a data table. But I do not believe it will allow you to read/write from a specific data table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.