YOUNAG Posted April 2, 2023 Share Posted April 2, 2023 Why did the code copied in the manual fail to read the analog voltage value? Did something go wrong? #include <gplib.h> #include <stdio.h> #include <dlfcn.h> #include <RtGpShm.h> //---------------------------------------------------------------------------------- // pp_proj.h is the C header for accessing PMAC Global, CSGlobal, Ptr vars // _PPScriptMode_ for Pmac Script like access global & csglobal // _EnumMode_ for Pmac enum data type checking on Set & Get global functions //------------------------------------------------------------------------------------ #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" void user_plcc() { unsigned int MySecondIoICAdr = pshm->OffsetCardIO[9]; volatile unsigned int *MySecondIoRawADC1 = (unsigned int*)piom + MySecondIoICAdr / 4; volatile unsigned int *MySecondIoRawADC2 = (unsigned int*)piom + MySecondIoICAdr / 4 + 1; volatile unsigned int *MySecondIoRawADC3 = (unsigned int*)piom + MySecondIoICAdr / 4 + 2; volatile unsigned int *MySecondIoRawADC4 = (unsigned int*)piom + MySecondIoICAdr / 4 + 3; unsigned int MySecondIoADC1u = (*MySecondIoRawADC1 >> 16) & 0xFFFF; unsigned int MySecondIoADC2u = (*MySecondIoRawADC2 >> 16) & 0xFFFF; unsigned int MySecondIoADC3u = (*MySecondIoRawADC3 >> 16) & 0xFFFF; unsigned int MySecondIoADC4u = (*MySecondIoRawADC4 >> 16) & 0xFFFF; int MySecondIoADC1s = (*MySecondIoRawADC1 >> 16) - 32768; int MySecondIoADC2s = (*MySecondIoRawADC2 >> 16) - 32768; int MySecondIoADC3s = (*MySecondIoRawADC3 >> 16) - 32768; int MySecondIoADC4s = (*MySecondIoRawADC4 >> 16) - 32768; } Quote Link to comment Share on other sites More sharing options...
YOUNAG Posted April 3, 2023 Author Share Posted April 3, 2023 thanks, The reason has been found, Because C code cannot be displayed in the window Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.