horacevan Posted February 3, 2012 Share Posted February 3, 2012 I need to read values from an Acc24E3, and perhaps write to them, from a background C program. I have spent several hours trying things, but nothing seems to get me the right data. I cannot find in the doc that I have read anything on how to do this. I can access other boards using pointers, but not this one. Could someone please explain how to do this and also where it is located in the documentation? Right now I am trying to read SerialEncDataA, but later will need to read some other values. An example would be greatly appreciated! Thanks, Bill Link to comment Share on other sites More sharing options...
Sina.Sattari Posted February 6, 2012 Share Posted February 6, 2012 Hi Bill, Here is a simple code I have written for ACC-24E2, which should give you an idea how to approach ACC-24E3: #include // Global Gp Shared memory pointer #include "../../Include/pp_proj.h" const double pi=3.1415926; struct timespec Sec2TimeSpec(double TimeSec) { struct timespec Timer; Timer.tv_sec = (long int)TimeSec; Timer.tv_nsec = (long int)((TimeSec-(double)Timer.tv_sec)*1000000000.0); return Timer; } void MySleepSec(double SleepTimeSeconds) { struct timespec Timer; Timer = Sec2TimeSpec(SleepTimeSeconds); nanosleep(&Timer,NULL); } int main(void) { volatile GateArray1 *pGate1; volatile int counter=0; InitLibrary(); pGate1 = GetGate1MemPtr(4); float mag = 0; float mag1 = 0.05882/10.0*exp2(31); while (1==1) { counter++; if (pGate1->Chan[2].Status&0x8000000) { pGate1->Chan[0].Pwm[0]=mag; pGate1->Chan[0].Pwm[1]=mag; counter=0; } else { pGate1->Chan[0].Pwm[0]=mag + mag1*sin(counter*pi/180.0); pGate1->Chan[0].Pwm[1]=mag + mag1*sin((counter+120)*pi/180.0); } MySleepSec(0.0001); } pGate1->Chan[0].Pwm[0]=mag; pGate1->Chan[0].Pwm[1]=mag; CloseLibrary(); return 0; } Link to comment Share on other sites More sharing options...
curtwilson Posted February 6, 2012 Share Posted February 6, 2012 Here's a very simple example of C access to registers in the ACC-24E3 ASIC. It should get you going. As stated in the above post, the method is the same for all of the ASICs. void CaptCompISR (void) { volatile GateArray3 *MyFirstGate3IC; // ASIC structure pointer int *CaptCounter; // Logs number of triggers int *CaptPosStore; // Storage pointer MyFirstGate3IC = GetGate3MemPtr(0); // Pointer to IC base CaptCounter = (int *)pushm + 65535; // Sys.Idata[65535] CaptPosStore = (int *)pushm + *CaptCounter + 65536; *CaptPosStore = MyFirstGate3IC->Chan[0].HomeCapt; // Store in array (*CaptCounter)++; // Increment counter MyFirstGate3IC->IntCtrl = 1; // Clear interrupt source } Link to comment Share on other sites More sharing options...
curtwilson Posted February 6, 2012 Share Posted February 6, 2012 This is explained in detail in the User's Manual chapter on writing C programs, starting on page 483 of the manual. http://forums.deltatau.com/filedepot/download.php?f=Power%20PMAC/Manuals/Power%20PMAC%20User [FILE REMOVED] Link to comment Share on other sites More sharing options...
horacevan Posted February 7, 2012 Author Share Posted February 7, 2012 This is explained in detail in the User's Manual chapter on writing C programs, starting on page 483 of the manual. Thanks Sina and Curt. The replies did the trick, but the real winner is the new User's Manual (and Software Manual). I didn't know there had been a total revolution in the Power PMAC manual world. If I had had these last week I could probably have figured out how to do it myself. They seem to be a great improvement over the old, preliminary manual pieces. Thanks again, Bill Link to comment Share on other sites More sharing options...
Recommended Posts