RomanSolonto Posted April 18, 2017 Share Posted April 18, 2017 Good day. // Local variables: #define adrMvar 3000 int modAdr = 0xFFF000FF; // Template variable int adr = 0; // Create a pointer to a structure: int MyFirstICAdr; int *MyFirstICGpioData; MyFirstICAdr = pshm->OffsetGate3[0]; // Gate3[0] MyFirstICGpioData = (int *) piom + ((MyFirstICAdr + 0x250) >> 2); // Defined pointer on Gate3[0].GpioData[0] // Read the value of the M-variable with a type cast and mask overlay: adr = ((int) GetPtrVar(adrMvar)) & 0x0000000F; // Modify a variable and pass it to the registry I/O Gate3[0].GpioData[0]: modAdr |= (adr << 16); // The result will be the following, when adr=0xf (for example): adr<<16 = 0xf<<16 = 0xf0000; modAdr = modAdr | 0xf0000 = 0xFFF000FF | 0xf0000 = 0xFFFf00FF pshm->Gate3PartData[0].GpioOutData[0] &= modAdr; *MyFirstICGpioData = pshm->Gate3PartData[0].GpioOutData[0]; // As a result, the outputs of MO1, MO2, MO3, MO4 (it Gate3[0].GpioData[0].16.4) must appear, but it does not appear Link to comment Share on other sites More sharing options...
Clopedandle Posted April 19, 2017 Share Posted April 19, 2017 All Gate I/O pointers must explicitly be defined as volatile. Digital I/O data (including GPIO) must be referenced as unsigned int only. You should only use masks on unsigned data. Link to comment Share on other sites More sharing options...
RomanSolonto Posted April 19, 2017 Author Share Posted April 19, 2017 Ok, I corrected the variable types: // Local variables: #define adrMvar 3000 unsigned int modAdr = 0xFFF000FF; // Template variable unsigned int adr = 0; // Create a pointer to a structure: volatile unsigned int MyFirstICAdr; volatile unsigned int *MyFirstICGpioData; MyFirstICAdr = pshm->OffsetGate3[0]; // Gate3[0] MyFirstICGpioData = (int *) piom + ((MyFirstICAdr + 0x250) >> 2); // Defined pointer on Gate3[0].GpioData[0] // Read the value of the M-variable with a type cast and mask overlay: adr = ((int) GetPtrVar(adrMvar)) & 0x0000000F; // Modify a variable and pass it to the registry I/O Gate3[0].GpioData[0]: modAdr |= (adr << 16); // The result will be the following, when adr=0xf (for example): adr<<16 = 0xf<<16 = 0xf0000; modAdr = modAdr | 0xf0000 = 0xFFF000FF | 0xf0000 = 0xFFFf00FF pshm->Gate3PartData[0].GpioOutData[0] &= modAdr; *MyFirstICGpioData = pshm->Gate3PartData[0].GpioOutData[0]; But the result is not changed - on the output port has no signal. Includes the following files: #include #include #include #define _PPScriptMode_ // uncomment for Pmac Script type access #define _EnumMode_ // uncomment for Pmac enum data type checking on Set & Get global functions #include "../../Include/pp_proj.h" #include Need to connect something else? Link to comment Share on other sites More sharing options...
RomanSolonto Posted April 19, 2017 Author Share Posted April 19, 2017 I use POWER CLIPPER Link to comment Share on other sites More sharing options...
steve.milici Posted April 19, 2017 Share Posted April 19, 2017 You cannot use both PPScriptMode and EnumMode simultaneously. Choose one. Link to comment Share on other sites More sharing options...
RomanSolonto Posted April 20, 2017 Author Share Posted April 20, 2017 Tried PPScriptMode and EnumMode: 1. // #define _PPScriptMode_ #define _EnumMode_ 2. #define _PPScriptMode_ // #define _EnumMode_ But the result is not changed - on the output port has no signal. What else could prevent the loading of a number in a variable Gate3[0].GpioData[0]? Link to comment Share on other sites More sharing options...
steve.milici Posted April 20, 2017 Share Posted April 20, 2017 This is a tecnical support issue. Please email your complete code to support@deltatau.com. Link to comment Share on other sites More sharing options...
Recommended Posts