04-30-2022 10:52 PM - edited 04-30-2022 11:09 PM
Well, they were my instructor's if you were curious lol
05-01-2022 09:41 AM
05-01-2022 12:22 PM - edited 05-01-2022 12:43 PM
Do you know why Index Array always outputs Initialize in the Start case? From my understanding, the Build Array is only composed of two elements, Finite and Continuous so I'm confused where it comes from. It causes me to get stuck.
05-01-2022 12:43 PM
Here's a hint:
Read the detailed help for "index array" and then tell me why you might end up with a default value. Oops, that's way more of a hint than I intended. 😉
05-01-2022 01:02 PM - edited 05-01-2022 01:42 PM
No, I'm not following at all. Everything is wired, so default value shouldn't be outputted. I'm thinking it has something to do with the sample mode enum.
05-01-2022 01:58 PM - edited 05-01-2022 02:43 PM
Well, your "sample mode" has three items, so you probably want to have an array of enums with three elements, one for each possibility (even if some might be the same). Am please resize the control so you can see the entire item string!
You know, instead of all these init to defaults cluttering the "initialize?" case, you could use the right method the initialize all to default in one operation, right? Also make sure that all controls have reasonable default values, of course.
Your events still lock the front panel, preventing you from ever stopping the continuous acquisition modes if you would press any of these buttons if the code is not in the idle state..
I still don't think you should use an event structure here!
Your stop button (and others) still have no label. the label must always be shown on the diagram to keep your sanity. If you don't want to see the label on the front panel, use the "visible items" right-click menu.
Doesn't it seem like a lot of extra work to erase the label for the two channel settings controls, then add a free label to "fake'-label them on the diagram? Next time the diagram is cleaned up, they free labels might end up elsewhere! Herding cats!
Don't use two buttons with the same boolean text ("stop"), that's just confusing the user!
The "Channel 2" control belongs before the case structure, eliminating the local variable.
Not sure why you removed all timing??
05-01-2022 03:44 PM - edited 05-01-2022 03:52 PM
@User002 wrote:
No, I'm not following at all. Everything is wired, so default value shouldn't be outputted. I'm thinking it has something to do with the sample mode enum.
You're close. Except your "Sample Mode" enum is not an enum at all - it's a RING, and the "Finite Samples" item has a value of 10178. You try to index the 10178th element of your array.
The help says:
And since you are trying to index an element that is out of bounds, it returns the default value of your array element, which is item 1, which is "Initialize".
Edit:
I think if the enum was strictly typed, it would've carried your default of "Queue" instead of "Initialize". (Which is still not right.)
05-01-2022 04:23 PM - edited 05-01-2022 04:51 PM
Hmmm, I think I solved the Sample Mode issue, but now there's an error with the waveform chart.
05-01-2022 05:07 PM
I replaced it with enums, and it now outputs the correct value, but a new issue is now coming from DAQmx Create Channel
05-01-2022 06:58 PM - edited 05-01-2022 07:00 PM
Think about it. You can't just arbitrarily replace those ring values with 0, 1, and 2 of the enum. Take your time, think it through. Think about the ramifications of what you've just done. I'm not trying to be coy. You have to develop these skills if you want to be even moderately successful once you get out of school.