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 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. 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... 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now