I am trying to read/write VI_PXI_BAR0_SPACE of PXI device using with VISA library. Here is sample C code how read data from BAR0 memory.
ViStatus res;ViSession defaultRM, vi;ViUInt32 oldData, newData;viOpenDefaultRM(&defaultRM);viOpen(defaultRM, "PXI0::CHASSIS1::SLOT3::FUNC0::INSTR",VI_NULL,VI_NULL, &vi);
//READ DATAViAddr addr = 0x8000;viIn32(vi, VI_PXI_BAR0_SPACE, adr, &oldData);printf("Addr: %04x Data:%08x\n", adr, data);//WRITE DATAnewData = 0x7FF7;res = viOut32(vi, VI_PXI_BAR0_SPACE, adr, newData);
This reading part is working without any issue. oldData = 0x7FFC.
I try to write newData = 0x&7FF7.
Something unexcpexted happen.I read data back i got = 0x7FF4.
looks like oldData and newData is logical AND somehow.
Does anyone have experience with reading/writing register BAR0 register map?