Hi Shannon,
The gather_buffer is declared as a million 64-bit double precision values. But it is really just a pointer to 8 Million bytes of memory. The GetGatherDec and SetGatherDec commands treat the buffer as 32-bit integers. So from C you might cast the gather_buffer pointer to a pointer to integers to access the integers. Below is an example.
#include "KMotionDef.h"
main() { int *p=(int *)gather_buffer; printf("integer gather buf value 100 is %d\n",p[100]); }
HTH
TK
Group: DynoMotion |
Message: 5494 |
From: roa_controls |
Date: 7/31/2012 |
Subject: Re: gather_buffer |
That did it. Works fine now.
Once again, thanks for your help!
Shannon
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Shannon,
> Â
> The gather_buffer is declared as a million 64-bit double precision values. But it is really just a pointer to 8 Million bytes of memory. The GetGatherDec and SetGatherDec commands treat the buffer as 32-bit integers. So from C you might cast the gather_buffer pointer to a pointer to integers to access the integers. Below is an example.Â
> Â
> #include "KMotionDef.h"
> main()
> {
> Â Â Â int *p=(int *)gather_buffer;
> Â
> Â Â Â printf("integer gather buf value 100 is %d\n",p[100]);
> }
> Â
> HTH
> TK
> Â
> Â
> From: roa_controls <sdavenport.roa@...>
> To: DynoMotion@yahoogroups.com
> Sent: Tuesday, July 31, 2012 11:08 AM
> Subject: [DynoMotion] gather_buffer
>
>
> Â
> Anybody know how to read the gather buffer in C? I populate the buffer with integers on the PC side with setgatherdec(n). I can read it with getgatherdec(n) and with the console but in C gather_buffer[n] returns either 0 or -216nnnnnn. I looked for examples in all the C programs and found: gather.list[n].type, gather.list[n].addr, gather.bufptr, gather.endptr I am not really sure what to do with them. I'm pretty new to C and suspect that maybe its something I'm doing wrong with the data type.
> Thanks, Shannon
>
|
|
| |