01-03-2012 11:13 AM
Hi,
Happy new years to you too!! You are right - 8 bits of data can be transfered at a time on a parallel port (I think there are 5 control lines that can be used too).
If I understand your question - your asking how can it have 8 digital inputs, 8 outputs, 1 analog in channel, 1 analog out, etc... If that is the question - it does it with latches and multiplexing.
I couldn't find the Out Port or In Port on Windows 7 x64 either. According to this link: http://digital.ni.com/public.nsf/allkb/496CD7613F331EA4862571E200633507 - Neither Microsoft nor National Instruments recommends reading/writing to the parallel port directly. There are a couple of parallel port adapters listed in the link that are supported - if you don't have a parallel port on your laptop anyway this may be a good solution.
Thanks,
Jim
01-03-2012 09:11 PM - edited 01-03-2012 09:16 PM
Thank you Jim
I found those vi s in my desktop..
According to my project I have to control stepper motor
The two stepper motor is controlled by controller and driver, but for changing the direction(forward and reverse) only I am going to use that DAQ (I don't need to change the speed through the process)
So I need two digital out put for each stepper motor and I am getting the position feedback from potentiometer. The potentiometer will give output 0-5V .
The aim is to turn the stepper motor to the specified angle (that is when the potentiometer reading and specified angle matches the process will stop the execution).
I can calibrate the angle after I got potentiometer reading in labview (in numerical indicator)
so ultimately I need 4 digital output and 2 analog input
I saw the port I/o vi in my desktop and now I have learnt how to read and write data in parallel port
If u give me any idea about accessing digital and analog input simultaneously it will be helpful for me.
Jim, I dint found any parallel port adaptor in that link.
once again thank you very much for our effort
01-04-2012 02:35 PM
Hi,
I hooked up a stepper motor before using the parallel port once but didn't do the feedback. I did get it spinning :-).
To read the ADC, refer to page 21 of the second attachment in this thread. Set up sequence steps corresponding to the 'Outport' and 'Inport' instructions in the 'C' code. There is some code there to check the status line - you will want to set up a 'while' loop for this.
To write to the output digital lines, look at page 33. It looks like it takes three 'Outport' instructions to set the output bits.
Yes your correct - no parallel port adapter in that link. You may have to do a search for an adapter or possibly buy an old computer with XP and a parallel port - I've seen them almost given away lately.
gl,
Jim
01-04-2012 08:52 PM
Thank you very much Jim,
I will try what ever u said and let tell u know.
I found those "c " codes but, there also they acquire or send any one type of data at a time.
I need to access 4 digital output and 2 analog input simultaneously.
I am basically mechanical engineer, don't know much about computer hardware and software
Can u please elaborate this little bit more...
Is there any way to access parallel port status lines in labview directly without using c codes?
If u give me one simple program for that daq to send 4 digital output and to acquire 2 analog input simultaneously, it will be useful for me.
01-06-2012 03:47 PM - edited 01-06-2012 03:56 PM
Hi,
I can't get into too much detail, but the overall concept is that the 4 digital bits and the analog lines can be read from and written to by writing and reading a series of bytes to the parallel port. For example, to do an analog read, some bytes need to be written to the parallel port to configure the device to make an analog voltage read, and then a software routine will wait for the conversion to complete, and then two bytes can be read from the parallel port and assembled to make a 12 bit conversion. For the digital output, some bytes have to be written to the parallel port to configure it to output digital bits and then you can write the value for the digital outputs.
I'll try to give an example by Monday - I have no way of testing it but it may give you a good headstart. The flow will look like the C programs. For example, to write to the digital bits, three bytes have to be written to the parallel port. In LabVIEW, this could look like a sequence (structure) with three frames each having an 'OutPort VI' in them with specific values written to the port. The analog input would look like a sequence with three frames to write three bytes, a while loop that uses 'InPort VI' to wait for the conversion to complete, and then two frames to read two bytes using 'InPort VI'. After the two bytes are read, the two bytes can easily be combined and the digital value converted to a voltage for display.
Yes, there is a way to directly read the status lines of the parallel port - it is simply another address using the 'InPort VI'.
There is no way to output the digital bits and read the analog input lines 'simutaneously'. There will probably be about a minimum of a 5ms delay between writing the digital outputs and reading the analog inputs or between any operations with this device.
Thanks,
Jim
01-08-2012 03:30 PM - edited 01-08-2012 03:31 PM
Hi,
Just a quick example of how to read the digital inputs. I don't have a way to check if it works. I can't give you code related to the stepper motor in case this is homework 😞 but it should give you a good idea of how to do it yourself. The diagram basically impliments the following C code from page 31 of the second attachment:
{
outport(0x37A,06); // Select Digital Input latch (LSB)
lb=inport(0x379); // Get the data from data lines
lb=lb^0x80; // XOR with 80 to remove 8th bit inversion
lb=lb&0xf0; // And with F0 to mask lower nibble
outport(0x37A,0x4); // Clear the latch
outport(0x37A,0x0E); // Select Digital Input latch (MSB)
hb=inport(0x379); // Get the data from data lines
hb=hb^0x80; // XOR with 80 to remove 8th bit inversion
hb=hb&0xf0; // And with F0 to mask lower nibble
data=hb+(lb>>4); // Final data = (MSB) + (LSB left shifted by 4 bits)
x=5;y=5;
gotoxy(x,y);
cprintf("Digital Input :: %x",data);
}