Jump to content

mccdaq! labview


vultac

Recommended Posts

QUOTE (vultac @ Nov 24 2008, 10:45 AM)

hey how can i represent something like this on labview?

8 D I/O lines.

Let D0 & D1 be pulses and D2 - D7 as digital lines

Start -> set D0 active high -> set D1 active high -> wait -> Set D0 active low -> wait -> set D1 active low -> finish.

You can use the sequence structure and the Wait (ms) function to accomplish this - but you'll have to read up on how exactly to communicate with your particular device.

Link to comment

QUOTE (vultac @ Nov 24 2008, 11:22 AM)

DAQmx can control one line at a time with different tasks, but it wouldn't surprise me if mccdaq can only read and write the 8-bit port in one shot. In that case you'll need to read up on http://en.wikipedia.org/wiki/Mask_(computing)' rel='nofollow' target="_blank">bitmasks

The basic operation is to read the port (the byte), pick the mask which will change the state as desired, and operate on the byte value, and then write the result back to the port.

In LabVIEW you don't have to do this with an array of booleans. The Boolean operators work just fine on integers and work like they would in C, that is, they operate on each bit independently.

To avoid race conditions, you need to protect the read-modify-write operation with a mutex, which can either be wrapping this change in just one subvi (you can perform the operation in multiple places, but it has to wrapped in a common subvii) or else by using LabVIEW semaphores. If your whole application is a big state machine or a big sequence you may be able to guarantee that only one operation can be tried in parallel, but relying on that is not recommended.

Link to comment

okay.....thx...im a little lost tho....well i was able to set D0 and D1 to go high and low...but its the timing now thats giving me a headache...well ive attached a jpeg of my progress so far~ struggling with the wait(ms) vi :/!!

Well the pic ive just attached basically shows me making 00000001(D0) go active high then making it go active low...thinking about how i could make D1 go active high when D0 is halfway through being active high....

Link to comment

QUOTE (vultac @ Nov 25 2008, 04:19 AM)

okay.....thx...im a little lost tho....well i was able to set D0 and D1 to go high and low...but its the timing now thats giving me a headache...well ive attached a jpeg of my progress so far~ struggling with the wait(ms) vi :/!!

Well the pic ive just attached basically shows me making 00000001(D0) go active high then making it go active low...thinking about how i could make D1 go active high when D0 is halfway through being active high....

I would work on the bitmasks first, so you can set any desired bit without setting any others (see earlier post).

Then I would make that into a subvi so that it's easy to reuse.

Only after that I would worry about the timing. How do you want to store the timing pattern? Are you going to make a pattern of ones and zero at some regular interval, or are you going to have a list of durations and the desired state for each one? There is no single right way to describe your waveforms; just try to pick the easiest way that is still useful.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.