Virtual Channel


Recommended Posts

I have created two virtual channels and a sequence which reads the value from a „real“ channel and adds it into history.

while (1)

DigitalOut = 0

read(Eingang0)

Virtual1=Eingang0

delay (10)

DigitalOut = 1

read(Eingang0)

Virtual2=Eingang0

delay (10)

endwhile

The V-channels Virtual1 and Virtual2 doesn`t show any values in the table. It stays empty. I also tried to log these V-channels, but it still doesn`t create a history in the input folder.

Link to comment
Share on other sites

Well, first I'd have to ask why you are using V channels? They are a bit old school and most of their features have been replaced by better solutions.

But as to why your code doesn't work, you have to put V. in front of V channels because technically the channels are on the V connection.

Also, note that you won't really easily be able to log these channels. You'd pretty much have to use an export set.

Also, be careful about this:

V.Virtual1 = Eingang0

By not subsetting Eingang0 you are technically trying to add the entire history of Eingang0 to the v channel. I believe in this mode, with =, it will actually only put the latest value, but its much better to be specific as to what you want:

V.Virtual1 = Eingang0[0]

Link to comment
Share on other sites

I try to control a multiplexer with the digital out port of Labjack. So AI0 port with the channel name Eingang0 gets two different values through the mux. These value should be saved for example with export. In my case I dont`t need a realtime saving option. However I have problems to export the values of V channel. I also don`t know how to clear history of V channel.

So can you come with a better proposal?:)

Link to comment
Share on other sites

Well, as I said, you have to put V. in front of all your V channels. To clear the history, just do V.MyChannel.ClearHistory(). That all said, I'd use test channels instead. Just create regular channels with device type test, I/O type A/D and a Timing of 0. Then you can do:

MyChannel.AddValue(Eingang0[0])

The advantage of this is that you can utilize all the other channel features such as logging, averaging, broadcasting (if using >= DF-Standard), and the persist files.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.