Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem writing to register on PCI-6120 using viOut8 when attempting to enable warp mode

I'm attempting to enable "warp mode" to sample at 1 MS/s on the PCI-6120 through Matlab, following the examples given here:

http://forums.ni.com/ni/board/message?board.id=232&thread.id=4350
http://zone.ni.com/devzone/cda/epd/p/id/3987

I see that I want to set various registers as follows:

To Disable Warp Mode

viOut8

address space: 12

offset: x1F

value: x80

 

viOut8

address space: 12

offset: x1D

value: d67

 

To Enable Warp Mode

viOut8

address space: 12

offset: x1F

value: xC0

 

viOut8

address space: 12

offset: x1D

value: d53


Using the function:



viOut8(ViSession vi, ViUInt16 space, ViBusAddress offset, ViUInt8 val8)



In Matlab, my code is:



loadlibrary('visa32.dll','visa.h','alias','myvisa');

defaultRM = uint32(1);

instr = uint32(1);

ref = int8(['PXI5::0::INSTR' 0]);


[status defaultRM] = calllib('myvisa','viOpenDefaultRM',defaultRM);

[status ref instr] = calllib('myvisa','viOpen',defaultRM,ref,0,0,instr);

val = uint8(1);


[status val] = calllib('myvisa','viIn8',instr,12,31,val);



Which works fine and is able to read the value of the register at address 12 and offset 31 (x1F).  However, if I try to write in the same way and then read it back, the write seems to have no effect:


status = calllib('myvisa','viOut8',instr,12,31,192);

[status val] = calllib('myvisa','viIn8',instr,12,31,val);



For both of these commands, status = 0 indicating the command completed successfully, but val is the original value, no matter what number is written with viOut8.  Also, if I use the "VISA Interactive Control" program, I find the same behavior.  I can read the same values, but if I try to write a value with viOut8, it has no effect.


Is there something I'm missing to be able to write to these registers?



Thanks,

Dave


0 Kudos
Message 1 of 5
(3,243 Views)
Hello Dave,

 

Since you don't have LabVIEW I have compiled the VI available in that developer zone article into an executable.  In order to run this VI you'll need to download and install the LabVIEW Run-Time Engine 8.5 (the full 98 Mb version).  Try running this VI to set the card to warp mode.  In the mean time I will try to track down a PCI-6251 and attempt the registry changes with the VISA Interactive Control to see if it works or not--I'll post back once I find out.  Let me know what you find when you try this VI.

 

 

Have a great weekend!

Brooks
0 Kudos
Message 2 of 5
(3,222 Views)
Hi Dave,

Our internal documentation says that those registers are write-only. I wouldn't expect reading them to give you any useful data.

Brad
---
Brad Keryan
NI R&D
0 Kudos
Message 3 of 5
(3,218 Views)
Hi Brooks,

Thanks for getting back to me.  I tried running the VIs, but they didn't seem to work.  If I run "Cont Acq&Graph Voltage in Warp Mode(6120).exe", then I am able to correctly set the 'VISA resource name' field, but I can't set the 'Physical Channel' field correctly for my system.  The default value is 'Dev5/ai0', but if I try to set it to 'Dev1/ai0' for my device, it won't let me edit the field and finds no devices when I browse, even though the card works correctly in Measurement & Automation and Matlab. 

Running "Warp Mode- 6120.exe" does appear to work, as it executes with no error, but if I then go to read the register values it's supposed to set using "VISA Interactive Control", the values I read are unchanged and are not equal to any of the values that the VI is supposed to set (the values I'm reading now are addr space: d12  offset: x1F value: xB2 and offset x1D value: x2D).  The only time I see these values change is before and after acquiring data with the Data Acquisition Toolbox in Matlab.

Are these the right registers to be setting?  The values appear to change to another value after every time I take data in Matlab.  These changes do not seem to be repeatable and appear to be independent of the data taking parameters (sampling rate, etc.).  It seems strange that they would be related to the sampling rate of the ADC if they change between multiple acquistions at the same sampling rate.

Thanks,
Dave
0 Kudos
Message 4 of 5
(3,213 Views)
Sorry Brad, just saw your message.  I guess that explains the strange values I was getting from trying to read them back.  I'll just assume the write is working as expected then.

Thanks,
Dave
0 Kudos
Message 5 of 5
(3,211 Views)