tweekzilla Posted July 9, 2013 Posted July 9, 2013 Reading the manual I don't think this is possible but I would like to be able to read the Pfm value that is pointed to by Motor[x].pDac - i.e. I don't want to have to keep a record of which motor is pointed to which hardware channel (hence the pointer in the first place). If I try and read the value via: int *temp; temp = pshm->Motor[1].pDac; printf("%i", *temp); My code just quits - no error no nothing. The problem is when you try and get the value from temp - i.e the printf statement. Reading the Pfm directly from the channel works fine. Is it possible to do this or would I need to keep a separate lookup for my C programs between motors and channels
shansen Posted July 9, 2013 Posted July 9, 2013 tweek: I wrote a simple program that printf's Motor[x].pDac, and I get a segfault when it executes. Examining the memory more closely, it looks like pDac is a pointer allocated in Delta Tau's program space. Therefore, this memory is not mapped into the process of our test program, which means a test program cannot access that memory. When I type Motor[x].pDac in gpascii, I get a human-readable return value: Ex: Motor[0].pDac --> responds with "Sys.pushm'. So, you should figure out where pDac is pointing for your system (probably to DSPGATE memory), and then map your pointer to that memory (e.g, Gate3[0].Chan[0].Dac[0]). TLDR; Cannot access pDac pointer directly, go to the source instead.
Recommended Posts