83rocketscientist
2008-04-06 03:40:04 UTC
Hello everyone,
I am trying to calculate the duty cycle of a digital signal using a USB-6009 Data acqusistion unit. While I am aware of the shortcommings of this unit for this type of application, if I calculate the duty cycle 100 times per second, that should be enough. The period of my square wave is about 10 milliseconds.
My first attempt (accelerometer_vi_2) I tried to use the "Pulse Measurement.vi" block, however, I think I am using the wrong data type for this block. Is there a way to convert the data type so I can use this block?
My second attempt was to replicate some of the ideas discussed here:
<a href="http://forums.ni.com/ni/board/message?board.id=170&message.id=182210&query.id=50252#M182210" target="_blank">http://forums.ni.com/ni/board/message?board.id=170&message.id=182210&query.id=50252#M182210</a>
Basically, for each period, you create an array where the duty cycle can be calculated by summing every 1 in a boolean array and dividing it by the length of the array. Instead of a boolean array, I used a binary array because I could not use the sum tool for a boolean array. Even with the binary array, however, the VI does not work!
I am sure the answers to some of this stuff is fairly simple, however, this is my first Labview VI, so I know I have a lot to learn! If there is a better way then the options I have discussed, to calculate the duty cycle, I am all ears!
accelerometer_vi_22.vi:
http://forums.ni.com/attachments/ni/70/8590/1/accelerometer_vi_22.vi
accelerometer_vi2.vi:
http://forums.ni.com/attachments/ni/70/8590/2/accelerometer_vi2.vi
I am trying to calculate the duty cycle of a digital signal using a USB-6009 Data acqusistion unit. While I am aware of the shortcommings of this unit for this type of application, if I calculate the duty cycle 100 times per second, that should be enough. The period of my square wave is about 10 milliseconds.
My first attempt (accelerometer_vi_2) I tried to use the "Pulse Measurement.vi" block, however, I think I am using the wrong data type for this block. Is there a way to convert the data type so I can use this block?
My second attempt was to replicate some of the ideas discussed here:
<a href="http://forums.ni.com/ni/board/message?board.id=170&message.id=182210&query.id=50252#M182210" target="_blank">http://forums.ni.com/ni/board/message?board.id=170&message.id=182210&query.id=50252#M182210</a>
Basically, for each period, you create an array where the duty cycle can be calculated by summing every 1 in a boolean array and dividing it by the length of the array. Instead of a boolean array, I used a binary array because I could not use the sum tool for a boolean array. Even with the binary array, however, the VI does not work!
I am sure the answers to some of this stuff is fairly simple, however, this is my first Labview VI, so I know I have a lot to learn! If there is a better way then the options I have discussed, to calculate the duty cycle, I am all ears!
accelerometer_vi_22.vi:
http://forums.ni.com/attachments/ni/70/8590/1/accelerometer_vi_22.vi
accelerometer_vi2.vi:
http://forums.ni.com/attachments/ni/70/8590/2/accelerometer_vi2.vi