Object: DirectAccessChannel
- Updated2024-09-12
- 1 minute(s) read
(AbstractDirectAccessChannels | BinaryDirectAccessChannels | Channels
Object: DirectAccessChannel
The DirectAccessChannel object provides access to a DirectAccess channel and the associated properties.
The following example creates a new channel group with a DirectAccess channel. When the channel values are read, each value is first multiplied by the factor 2, and then the offset 5 is added.
Dim oBlock: Set oBlock = File.GetBinaryBlock() Dim oChn : Set oChn = oBlock.Channels.Add("MyChannel",eI32) Dim oMyGrp: Set oMyGrp = Root.ChannelGroups.Add("MyChannelGroup") Dim oMyChn: Set oMyChn = oMyGrp.Channels.AddDirectAccessChannel(oChn) oMyChn.Factor = 2 oMyChn.Offset = 5
The following example reads in the values of the worksheet columnwise from the second row of the first column and saves the values in channels of the first channel group:
Dim oCurrSheet: Set oCurrSheet = Workbook.Sheets(1) Dim oCellBlock: Set oCellBlock = oCurrSheet.GetCellBlock(2,1) Dim i, Name, oNewChannel For i = 1 to oCurrSheet.MaxPosition.Column Name = oCurrSheet.GetCellValue(1,i) Set oNewChannel = oCellBlock.Channels.Add(Name) Call Root.ChannelGroups(1).Channels.AddDirectAccessChannel(oNewChannel) Next
Methods
Returned From
AbstractDirectAccessChannels.Item | BinaryDirectAccessChannels.Add | BinaryDirectAccessChannels.Item | Channels <DataPlugin>.AddDirectAccessChannel | Channels <DataPlugin>.Item | ChannelsToProcess.Add | ChannelsToProcess.Item | DirectAccessChannels.Add | DirectAccessChannels.Item | DirectCellChannels.Add | DirectCellChannels.Item