Hi Again,
This is how I have written the code for the described format. Can anyone tell me where I am wrong. I am not able to read the correct data, and move with reading the inputs for the next channel.
Test header is 80 byte record.
SubHeader is 160 byte record.
The unused bytes are spaces.
If assume the blocklength and the datatype if specified correctly can make things clear.
Can anyone help me out with this.
Sub ReadStore(File)
Dim i, Block, Group, Channel, ChannelName, Channelcount
Dim count, intblockwidth, intcount
' Dim chnrefno(),daschnno(),dassubchnn0(),chnsamples(),datasamples(),
File.Position = 0
'The first 8 bytes gives the test ID
Set Group = Root.ChannelGroups.Add(File.GetCharacters(8))
'next 6 bytes are irrelevent so skip them
'8 + 3 + 3 = 14
File.position = 15
'The next 3 bytes tells the number of channels present in the file
Channelcount = File.GetCharacters(3)
'the rest bytes are unused, hence skip to subheader now.
File.position = 81
' intblockwidth = 0
' msgbox Channelcount
' for intcount = 1 to Channelcount
' intblockwidth = intblockwidth + 2
' Next
'intblockwidth = 2
Dim intchnrefno, strDASchno, intDASsubchno,intscalingsamples, intdatasamples
Dim intprezero, floatsamplerate, intcalptcon1conv, intcalptcon1eng, intca2ptcon1conv, intca2ptcon1eng
Dim intdataresolution
For count = 1 to Channelcount
intchnrefno = File.getcharacters(5)
strDASchno = File.getcharacters(4)
intDASsubchno = File.getcharacters(3)
intscalingsamples = File.getcharacters(10) 'if zero cal data in cal 1 and 2
intdatasamples = File.getcharacters(10) ' Gives the number of Data samples in the channel.
intprezero = File.getcharacters(10)
floatsamplerate = File.getcharacters(11)
intcalptcon1conv = File.getcharacters(6)
intcalptcon1eng = File.getcharacters(11)
intcalptcon2conv = File.getcharacters(6)
intcalptcon2eng = File.getcharacters(11)
intdataresolution = File.getcharacters(3)
'80+160 = 240 test header is 60 byte and subheader is 160 so 90 bytes are used under subheader, hence 160-90
'so setting the file position to the next byte. to start reading data.
File.position = File.position + 71
File.Formatter.ByteOrder = eLittleEndian
' File.Formatter.ByteOrder = eBigEndian
Set Block = File.GetBinaryBlock()
' Block.BlockWidth = intblockwidth
'Block.BlockLength = intdatasamples
Set Channel = Block.Channels.Add(strDASchno, er32)
Call Group.Channels.AddDirectAccessChannel(Channel)
Next
End Sub
Thanks,
Priya