Jump to content

PHP code needed to write to Parallel LPT1 port


thegadgitman

Recommended Posts

I have a small project. I have a control board that is connected to the parallel port.

 

It controls 8 strips of LED on the LPT1 port.

 

I can turn these on and off via the command prompt, using LPTOUT.exe  ie lptout 1  turns on the 1st LED

 

lptout 2  will turn off 1st LED and turn on 2nd,  lptout 4 turns on 3rd and 2nd off, etc

1, 2, 4, 8, 16, 32, 64, 128.    and combinations ie lptout 3  turns on LEDS 1 and 2, and so on.

 

However lptout seems very unresponsive sometimes I have to do lptout 1  twice before LED 1 turns on.

 

Is there another command I can use to write to LPT1 port.

 

I need some PHP code to control the outputs.

 

I want to sequence the outputs ie  1on (1second) 2on (1 second) 3 on (1 second) 4 on  etc. to 8, then all off then repeat.

 

Can anyone help me.

 

THANK YOU.

 

Link to comment
Share on other sites

  • 10 months later...

Did you ever figure this out? I read where you should be able to use "sleep(1);" between each command and it would put a 1 second delay before it executed each command. I haven't ever used it and might have a use for it coming up. I am curious how you accomplished this. Also I read where you can use "usleep(250000);" for a 1/4 of a second delay.

 

Link to comment
Share on other sites

Lets go over how do do the blinking first.

 

you'll want to use pack http://php.net/manual/en/function.pack.php to take a number (say from 1-8) and turn it into binary.

 

then you'll need a loop going from 1-8, calling pack with the current number that you're on, and passing that as an array / argument on to your function that writes to the parallel port.

 

here is a link that should get you started on writing to ports in windows. http://www.governmentsecurity.org/forum/index.php?showtopic=16247

 

good luck!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.