Question:
Does Matlab sample
digital data at a fast sample rate?
Answer:
You can
clock in
digital input data while in Matlab. The sample rates available are determind by the sample rate of the analog input subsystem. The device I used to test is a DT9832 with 4 analog input channels and the fifth input channel, here I've added the fifth channel as HwChannel 4. Normally all the
digital inputs are high or 1's, the user needs to tie a
bit to
ground to pull it low so it'll read 0.
The 16 bit digital input value is read as a value from the A/D converter so it looks like a voltage value. If you view the data in 'native' mode you can see the value change from 65535 to 65534 when bit 0 is connected to ground. When bit 1 is connected to ground the value changes to 65534 and so on. If you just want to acquire digital data you can just use channel 4, "addchannel(ai, 4)".
Here's some of the commands I used to test this and the responses from the DT9832 ai = analoginput('dtol', 0);
Here's some of the commands I used to test this and the responses from the DT9832>
Here's some of the commands I used to test this and the responses from the DT9832>> ai.InputType='SingleEnded'
addchannel(ai, 0:4)
>
>>
Index: ChannelName: HwChannel: InputRange: SensorRange: UnitsRange: Units:
>
>>1 '' 0 [-10 10] [-10 10] [-10 10] 'Volts'
2 '' 1 [-10 10] [-10 10] [-10 10] 'Volts'
3 '' 2 [-10 10] [-10 10] [-10 10] 'Volts'
4 '' 3 [-10 10] [-10 10] [-10 10] 'Volts'
5 '' 4 [-10 10] [-10 10] [-10 10] 'Volts'
start (ai)
data = peekdata(ai,1)
data =
-0.0154 0.5498 -1.4736 0.6816 10.0000
>
>>
start (ai)
>
>> data = peekdata(ai,1,'native')
data =32754 34579 27950 35015 65535
start (ai)
data = peekdata(ai,1,'native')
>
>>data =32762 34593 27968 35028 65534
>
>> start (ai)
data = peekdata(ai,1,'native')
data =32748 34574 27948 35011 65533