Jump to content

Basic Serial LPT Out (Lighting up LEDs)


Warren

Recommended Posts

I had hoped to set up this little experiment to learn more about Serial I/O to use in a future project - However I have had no end of difficulty just starting with this. I have a small circuit with 4 LEDs connected in parallel to (2,3,4,5) pins on the port. (I have 470 Ohm resistors in series with each of these) I have tied (11, 12) to ground. I have attempted to use labview to send some form of signal to the LEDs without success. I used both the serial VISA and out port. I have also reviewed the examples (Basics serial read write) but I think I have forgotten somthing, or I am doing somthing fundamentally wrong. I have also read through many online sites about the fundamentals of the Serial Port - but I must be missing somthing.

Any help would be greatly appreciated. - Let me know if there are any details i neglected to mention.

- Warren.

Link to comment

QUOTE (Warren @ May 29 2009, 09:41 PM)

I had hoped to set up this little experiment to learn more about Serial I/O to use in a future project - However I have had no end of difficulty just starting with this. I have a small circuit with 4 LEDs connected in parallel to (2,3,4,5) pins on the port. (I have 470 Ohm resistors in series with each of these) I have tied (11, 12) to ground. I have attempted to use labview to send some form of signal to the LEDs without success. I used both the serial VISA and out port. I have also reviewed the examples (Basics serial read write) but I think I have forgotten somthing, or I am doing somthing fundamentally wrong. I have also read through many online sites about the fundamentals of the Serial Port - but I must be missing somthing.

Any help would be greatly appreciated. - Let me know if there are any details i neglected to mention.

- Warren.

Ok. Couple of points.

1. Most parallel ports nowadays have internal pull-up resistors (4K7). Whilst this makes input a lot safer/easier, it means that drive capability is severely restricted. This might be limiting your current to about 1mA (a DVM will tell you if this is the case or not).

2. To use the parallel port as digital IO in Labview, you need to make sure it is set ti "Standard" in the bios (Not SPP,ECP etc).

3. There is a parallel pot example of using it as a digital IO in the examples directory (Port IO) and I would suggest using this (as it is a direct port write) rather than VISA to get it going.

Link to comment

Sorry I took so long to get back to everyone.

To answer the first reply: I have been sending single ASCII characters out, but on other attempts I have tried some hex and just binary (four 1's 0's randomly...as a shot in the dark) Im choosing the VISA port corresponding to 0x278...for me that should be LPT1 (some times all i can input is 278). Also I have Posted the Visa vi that I built quickly myself, but mostly I have been trying to get the built in examples to work..."Parallel port read / write loop" and "basic serial read/write"

To answer AnalogKid: I am pretty sure the hardware is not an issue. Sometimes when I just boot the computer, the output pins are already tied high (I think) because the lights are all lit up, or only a few are...but I just have no control over it.

To answer ShaunR: I have gone into the bios and taken a look at the options for the ports and I did have it set for "Standard" so I dont think that is a problem. Also, I took a look for the PORT IO example you spoke of in the "find examples" search and I could not find it. Currently I am using 7.0 (so that may be an issue), but I will head over to my other computer and check out 8.0.

Am I specifying the output port correctly? Is the output to the LED's in the right format? Any other Ideas would be really appreciated.

Thanks Again.

- Warren.

Link to comment

QUOTE (Warren @ Jun 1 2009, 08:04 AM)

To answer the first reply: I have been sending single ASCII characters out, but on other attempts I have tried some hex and just binary (four 1's 0's randomly...as a shot in the dark) Im choosing the VISA port corresponding to 0x278...for me that should be LPT1 (some times all i can input is 278). Also I have Posted the Visa vi that I built quickly myself, but mostly I have been trying to get the built in examples to work..."Parallel port read / write loop" and "basic serial read/write"

"278" is NOT going to work as an input to the Visa Port. "LPT1" should work. "ASRL10::INSTR" should also work. If you right click on the VISA port, there are some options as to whether it accepts undefined names. These keep changing with different VISA/LabVIEW versions.

The Parallel Port example ShaunR mentioned is at "C:\Program Files\National Instruments\LabVIEW 8.6\examples\portaccess\parallel port examples.llb\Parallel Port Read and Write Loop.vi" on my computer. I don't know if it's on version 8.0, but I think you're wasting time if you don't get your hands on a current version and try this out. The vi.lib VIs which it uses are at "C:\Program Files\National Instruments\LabVIEW 8.6\vi.lib\Platform\portaccess.llb"

Good luck

Jason

Link to comment

QUOTE (jdunham @ Jun 1 2009, 07:27 PM)

The Parallel Port example ShaunR mentioned is at "C:\Program Files\National Instruments\LabVIEW 8.6\examples\portaccess\parallel port examples.llb\Parallel Port Read and Write Loop.vi" on my computer. I don't know if it's on version 8.0, but I think you're wasting time if you don't get your hands on a current version and try this out. The vi.lib VIs which it uses are at "C:\Program Files\National Instruments\LabVIEW 8.6\vi.lib\Platform\portaccess.llb"

Good luck

Jason

Thanks for identifying the exact location (the PC I wrote the reply on didn't have Labview so couldn't check).

QUOTE

Currently I am using 7.0 (so that may be an issue), but I will head over to my other computer and check out 8.0.

I've been using it since LV version 2.x so it will be in 7.0.....somewhere (foolow JD's path). It really is all you need (unless you are going to go to parallel comms) and works on all windows versions.

Link to comment

Thanks for the suggestions everyone. That example "C:\Program Files\National Instruments\LabVIEW 8.6\examples\portaccess\parallel port examples.llb\Parallel Port Read and Write Loop.vi" is in version 7, and I've actually had it open a few times, but I can't get anything to happen. The LEDs are lit up but thats how they are when the computer boots. I've been taking a look at "Labview for Everyone" and it says that if the Baud rate/ other settings arn't the same as the specs for the port then nothing will happen, but for that specific VI I dont see an option to change them. In the end I hope to use the serial port to communticate with a PIC (but I guess I need to overcome this obstacle first)... If anyone has any experiance with that and could shed some light on this problem that would be great.

Also, I'm kind of limited to the older versions of Labview because in the lab where I hope to apply this, the equipment is kind of dated - and Im told a new version of labview is not an option. (but I agree that it would be nice)

Link to comment

QUOTE (Warren @ Jun 1 2009, 01:30 PM)

Thanks for the suggestions everyone. That example "C:\Program Files\National Instruments\LabVIEW 8.6\examples\portaccess\parallel port examples.llb\Parallel Port Read and Write Loop.vi" is in version 7, and I've actually had it open a few times, but I can't get anything to happen. The LEDs are lit up but thats how they are when the computer boots. I've been taking a look at "Labview for Everyone" and it says that if the Baud rate/ other settings arn't the same as the specs for the port then nothing will happen, but for that specific VI I dont see an option to change them. In the end I hope to use the serial port to communticate with a PIC (but I guess I need to overcome this obstacle first)... If anyone has any experiance with that and could shed some light on this problem that would be great.

This ones resolved. I found an example a few days ago that pertains to Serial I/O, I'm not sure who the author is, but if he/she ever reads this thanks so much. I've attached an example of the VI. - For anyone who is attempting the same thing here's some tips ( A summary of what I learn from the above):

Remember to tie 11,12 to ground (19/20...) and be sure that that each output is reduced in some way before reaching the LEDs (I used 470 ohm) and remember LED - light emitting DIODE (so don't accidentally reverse bias them and wonder why there not lighting up!). And the last point, remember to set up the port properly in the system bios.

Well a serial port is totally different than a parallel port (well, they both use copper and electrons...). Parallel ports don't have a baud rate. It's a bit weird that VISA controls the parallel port and pretends that it's a serial port but don't let that throw you. If you try to set LPT1's baud rate, stop bits, parity, etc. in Visa, it will probably just ignore you.

Most of the stuff in LabVIEW for Everyone should be about serial ports because they are much more common for communicating with real stuff you might get paid to work with. Parallel ports used as digital I/O is mostly for fiddling around when you're too cheap to buy a $100 I/O board from NI. Nothing wrong with being cheap but most companies are going to want the real thing.

I'm glad you got it running!

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
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.