Jump to content
OMRON Forums

Access value in motor[x].pDac from C


tweekzilla

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...