Discussion:
Digital Communication PCI 6221
(too old to reply)
Billq
2008-07-11 11:10:07 UTC
Permalink
Hi,

I am a relative newcomer to Labview and the first project I have had to deal with is a difficult one (for me anyway). I am using an M series DAQ board (PCI 6221 ? which I have been assured is suitable) and I am hoping to communicate with a humidity and temperature sensor. The sensor requires the following sequence (see attachment) to call the data and to read. I need to control the data and clock line.



I believe I am sending out the correct signal as far as the where the data line takes control. I am having difficulty getting the program to read the data line and setting the clock line simultaneously.

Any help regarding this problem would be much appreciated,

Regards,

Bill


Sequence.JPG:
Loading Image...
RER
2008-07-14 13:10:11 UTC
Permalink
Hey Bill,

It certainly sounds like an interesting and rather sophisticated experimental setup you have. I am more than happy to help you out on this one, but I would like a little more information from you please.

Could I ask for some more details concerning the humidity sensor, and perhaps a link to the manufacturers website. Could you also post your VI(s) onto this forum please. Finally, what is the acquisition/generation rates specified for the clock and data lines.

To end on a positive note, I am the lucky owner of a PCI-6221 myself and I agree that (pending the acquisition/generation rates) you should be able to implement the specified functionality using this card. As for your code, I imagine that it will be a matter of implementing parallel, data-independent loops ? one for the read, one for the write.

Thanks for your time, and I look forward to hearing from you soon,
Billq
2008-07-16 15:40:11 UTC
Permalink
Hi Rich, Thanks for the response. It has been difficult to find information on this type of problem. The data sheet for the sensor is from the Sensirion (www.sensirion.com) website.http://sensirion.com/en/01_humidity_sensors/03_humidity_sensor_sht15.htmI have attached the VI I have designed for outputting the required signal. I have tried to test the reading of a signal by attaching Line 0 and Line 4 and reading as it writes but it never records the signal. Using the "highlight execution" it seems that the writing and reading processes do not occur at the same time.From talking with people who have some experience of these types of problems, I don't think data acquisition/generation rates are an issue here and that the rates can be determined by the programmer.Hoping you can point me in the right direction,Thanks again,Bill


Signal Output.vi:
http://forums.ni.com/attachments/ni/70/9188/1/Signal Output.vi
RER
2008-07-17 12:10:09 UTC
Permalink
Dear Bill,
I will keep this short and sweet (a VI speaks a thousand words), but please have a look at the attached example code. It has been saved in labVIEW 8.2, as I was unsure what version of LV you are using. Head to the block diagram and change the channels names to suit your setup. As it stands, I am writing to a single digital line and reading from a single digital line within the same digital port. On the hardware side, I have physically wired the channels together.
Once you are happy with the example VI, you should be able to edit this VI to interact with you actual sensor.
Best wishes,


Digital IO example.vi:
http://forums.ni.com/attachments/ni/70/9198/1/Digital IO example.vi
RER
2008-07-23 16:40:10 UTC
Permalink
Hi Bill, how did you get on with my modified VI?
Billq
2008-07-24 13:40:10 UTC
Permalink
Hi Rich,
Thanks for getting back to me on this. I have modified your VI to write both the data and the clock lines. I am almost sure my code is right but I will check again. At the end of the sequences the data line should be pulled low but thus far it has not happened. 
Any feedback would be appreciated,
Bill
 


Digital Check (Boolean).vi:
http://forums.ni.com/attachments/ni/70/9231/1/Digital Check (Boolean).vi
RER
2008-07-24 14:40:11 UTC
Permalink
Dear Bill,
I am afraid that there is a significant issue in your code. You can not read from the same channel/task you have configured to be a an output channel/task. You will need to use the DAQmxSTOP function (as I did in my code) to end the DigitalOutput task once you have finished writing AND you have stepped out of the for loop.
Once this is complete, create a new task Digital Input task to read from the same line, before stepping into the while loop to start reading. You can use the error clusters to ensure that your code exercutes in the correct sequence.
You should get into the habit of closing or clearing your DAQmx tasks and channels once you have finished using them. This will ensure that resources have been freed up.
I hope that this has been of some use to you. Please let us know how you get on.Best wishes,
Billq
2008-07-24 16:40:09 UTC
Permalink
Hi Rich,
Thanks again, the while loop was something I added in just as a quick check method. Thanks for the information regarding my error, it is something I needed to know. The code is actually sending out correctly as instead of using the second while loop I simply used a multimeter and it showed the dataline is in fact being pulled low but instead of to <1 it is being pulled from 4.9V to 2.76V.
Thanks for your help thus far. If it's ok with you, if I run into any difficulties I will use this thread?
Thanks again,
Bill
RER
2008-07-25 11:10:12 UTC
Permalink
Dear Bill,
I have enjoyed working with you on this issue, so I feel that I should be update you such that I won't be wasting any of your time. I am going to be out of the office for the next week or so, therefore it may be beneficial for you to create a new forum thread (and provide have a link to this particular thread) for any questions you may have over the next week or so. Otherwise you may have a significant wait for my next reply.
This means that your questions will be picked up by either my colleagues at NI or the amazing, active comunity we have on these forums.
Again, feel free to post directly to this thread, but it may be a wee while before you hear back from me.
Best wishes and kind regards,
 
Billq
2008-08-15 17:10:12 UTC
Permalink
Hi Rich,

Here is the almost finalised program. I was wondering could you have a look at it and inform me of any mistakes in the code as before. It is displaying the correct values for both humidity and temperature. Also in the Humidity Vi I have a question regarding voltage from the digital I/O. I am currently waithing a set time to allow the line be pulled low, is it possible to read this directly so I don't have to wait. I had hooked it up to an analogue input but this is a little messy.

Thanks again for all your help,
Bill


SHT 15.llb:
http://forums.ni.com/ni/attachments/ni/70/9386/1/SHT 15.llb

Continue reading on narkive:
Loading...