LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help to use parallel port to control 8 digital potentiometers

Hi,
 
I would like to use LabVIEW 7.1 on a machine running windows XP to control 8 digital potentiometers through the parallel port. The following is a link to the datasheet for the digital pots which should be helpful for understanding my questions (I am using the 8 pin version). Please see the Serial Interface and pin description sections.

http://rocky.digikey.com/WebLib/Microchip/Web%20Data/MCP41XXX_42XXX.pdf

Each pot needs to have a serial clock in, control signal in, and serial data in. I understand how to use the parallel port to control the 8 different serial data lines for each digital pot, but I am not sure how to control the other two signals needed by each digital pot. I think using the strobe pin on the parallel port would be sufficient for the serial clock input. The digital pot reads in its data on the edges of the serial clock, and to my understanding the strobe pin changes with each byte sent. Every byte sent through the parallel port would correspond to one bit on each individual digital pot so I hope that will work out. The control signal input is what I am not sure of. According to the digital pots specifications, this signal needs to be held low for 16 bits (8 control bits and 8 data bits) while sending data, and data will not be passed if it is not low for a multiple of 16. I would like to use pin 16 of the parallel port as my control signal, which to my knowledge is an output on the control register. I have some questions about this. Can the control bits be set at the same time as the data pits on a parallel port or does the address have to be switched in between two such commands? How do I change the address so that I can write to different registers for the parallel port in LabVIEW? Can this be done with the Instrument I/O express VI?

I have already looked through many forum  and tutorial pages on the parallel port but I have not found anything useful for my application. Help!

Thanks,

Kurt
0 Kudos
Message 1 of 5
(3,573 Views)
Hello,

That is quite an application to attempt on a parallel port!  I do not currently know the details of how the lines other than the data lines of the parallel port operate, but maybe we can look into it together.  Before we do that, though, have you thought about using a data acquisition card to perform this task?  It may be worth at least browsing your options and pricing to see if it is worth the cost to make your programming simpler.

http://www.ni.com/dataacquisition/

As for your question about the Instrument I/O Assistant, you will not be able to use this Express VI to perform this application on the parallel port.  The Express VI is used to send and receive messages, which you can do with the parallel port, only not what you are trying to do.  In order to use the lines other than the data lines, and to toggle them on and off in the manner you are describing, you would need to use the In Port and Out Port VIs, which actually use register access to communicate using the serial port.  Since the Instrument I/O Assistant is message-based, not register-based, it will not work for this application.

Let us know your thoughts on using a data acquisition card as compared to the parallel port, and we'll go from there!

john m
Applications Engineer
0 Kudos
Message 2 of 5
(3,537 Views)
Hi John,

I would have replied eariler but this part of the NI site was down over the weekend. Anyway, I have a 6023e daq card, but let me bring you up to speed with my progress over the weekend before I get into that.

I switched to using the out port.vi and switched the parallel port from ecp to spp mode and I am getting limited success. I am starting small by trying to just control one digital potentiometer through one data line, a strobe line, and a chip select line. I can get the data line to behave correctly, but the strobe pin is not switching on and off with each byte that is sent like it should be. I guess I am not 100% sure that it "should be" though. I thought that it was the natural behavior of this pin to switch on and off with every byte sent, but I guess its possible that in print operations there is some other code controlling this. Anyway, when data is sent I do see some small changes in the strobe line that are aligned with the rising and falling edges of my data line, but certainly not in the square wave form that is expected and on a much smaller scale than 0 to 5V. So I really have no idea why that is not working correctly.

As for my chip select line (I called it "control signal in" accidentaly in the last message) I tried using both pin 16 and pin 17 on the parallel port, which are both outputs on the control register. I don't think that they will be able to replicate the operation of the chip select line though because their outputs are not latching. Even when I send the message to drop the charge on that line with every run through the program the charge climbs back up to 5V in the time intervals between each byte being sent. On a side note it might be worth a try to use one of these as my strobe line if they are behaving in such a manner. Since chip select was not working correctly through any of the parallel port pins, I decided to use a digital I/O on my daq card to replicate the operation. The daq card is also being used for another part of my application which involves two analog inputs and a trigger input to calculate a distance measurement. By the way I am a student at BU going into my junior year and I am building a small phased array ultrasonic imaging system. So I would only have 7 digital I/Os available on my daq card. I guess it is possible that I could replicate the strobe and chip select lines as analog outputs so that I would have the 8 necessary digital I/Os left over but I am not sure that this is a good idea. I would also be concerned about the timing of the operation using LabVIEW. This whole operation is being looped and there is some precise timing involved between the data sent to each delay line and the signal output for the ultrasonic transmitters which is controlled by a microcontroller. I ran into many timing issues with LabVIEW when I was trying to complete the ranging part of my project, but I realize this is due to the operation of windows. Do you have any more thoughts or ideas on that?

Thanks,

Kurt
0 Kudos
Message 3 of 5
(3,526 Views)
If I were you, I would add a demultiplexer chip to you circuit (i.e. 74LS138 for TTL).  This way you can use 3 of your data lines to to select which of the 8 pots you want to talk to, 1 line to enable/disable the demultiplexer, and then you would only need 2 more lines for the clock and data to the pots.  In other words, all of the pots would share the same data and clock lines, but only one pot would be enabled at a time (an addressable system).  You would only need 6 lines total with this design
Randall Pursley
0 Kudos
Message 4 of 5
(3,524 Views)
Hey Randall,

Thanks for the idea, but I would like to control all eight at once. Sorry, I may not have made that clear in my past messages. In between every pulse that is transmitted by my system, the values of these potentiometers need to be changed in order to control the delay on each line. I believe I have it set at about 45 ms between each pulse trigger from my "orchestrating" microcontroller at this point, and in between each of these is where the values are changed so that the next pulse will be focused in the next desired position. I want to make sure this operation take place well before the next transmission, I plan on trying to make the system as fast as possible, and the programming also will include a while loop. It has been suggested to me that trying to make a while loop operate a lot faster than what I am doing right now might cause problems and I would like to avoid that.

Actually in the hour or so since my last reply I think I got one line working. I am still playing around with it trying to make sure that it is actually behaving correctly. I used a digital I/O as my chip select, pin 17 as my strobe (controlled through programming), and pin 2 as my one data line at this point.

Thanks,

Kurt
0 Kudos
Message 5 of 5
(3,517 Views)