RESOLVED - Calculating Register Pointer-Adresses hannsx Member Posts: 102 Threads: 26 Joined: Mar 2018 06-02-2021, 06:11 AM (This post was last modified: 07-05-2021, 06:02 AM by hannsx.) Hi, I wanted to ask how you calculate the Adress for the Gate3[0].HomeCapt[1] Register. My Problem ist that I just do not seem to get it right when I use it in the Interrupt Service Routine. Here is how I calculate it: int Gate3ZeroAdress; int *G3ZhomeCapt ; Gate3ZeroAdress = pshm -> OffsetGate3[0] ; G3ZhomeCapt = (int*)piom + ((Gate3ZeroAdress + 0x80 + 0x74) >> 2) ; 0x80 Is the Offset for Chan[1] 0x74 Is the Offset for HomeCapt The use of the Gate-Array structure volatile GateArray3 *MyFirstGate3IC; MyFirstGate3IC = GetGate3MemPtr(0); and consequently MyFirstGate3IC -> Chan[1].HomeCapt in the Interrupt Servo Routine clears the register and rearms it for the next Interrupt when I read that Register out. When I read out G3ZhomeCapt it does not rearm clear the register or rearms it. Can someone tell me why G3ZhomeCapt != MyFirstGate3IC ->Chan[1].HomeCapt ? Best regards, hannsx Eric Hotchkiss Delta Tau Insider Posts: 425 Threads: 1 Joined: Oct 2016 06-03-2021, 09:03 AM If you want to use a direct pointer based on numerical addresses, it would look like this. Code: ```volatile unsigned int *MyHomeCapt1; MyHomeCapt1 = (unsigned int *)piom + pshm->OffsetGate3[0]/4 + 0x80/4 + 0x74/4;``` It would be much easier to use gate pointers like below, however they will use more memory. I would recommend this method if possible. Code: ```volatile GateIOStruct *GateIo[1]; GateIo[0] = GetGateIOMemPtr(0); GateIo[0] -> DataReg[3] = (0xFF << 8);``` I am attaching a couple short sections about these pointer types. Attached Files   direct pointers.pdf (Size: 724.38 KB / Downloads: 17)   gate pointers.pdf (Size: 641.04 KB / Downloads: 15) « Next Oldest | Next Newest »