Jump to content

Port status


wkellen

Recommended Posts

Hello,

 

I have a webpage that runs some php code to control electrical devices. One part of it controls outside lights. Another part controls an electric door striker. I keep expanding the functionality of it and need to change one pin of the port without affecting the others. So far I use a different port for each function but I am out of ports so I need to use the different pins of the parallel port.

 

I am using a linux ubuntu server.

From my php webpage I issue this command: <?php exec("/home/setSerialSignal /dev/ttyS0 0 0"); ?> which controls the lights using the serial port. I can control 2 pins but I can't check the status of them so if I make a change to one pin it cancels the other.

 

For another one I use the parallel port with this command: <?php exec("/home/parashell 0x378 1"); ?> which turns on pin #2 of the parallel port.

 

Parashell has an executable called "pin". If you type the command "pin 0x378" it will return a value for the status of the parallel port. "1" for example which tells me that pin #2 is on. Is there a way to pass this value to a php variable?

 

I am looking to be able to read the status of the port and make changes to just the pin I want.

 

Lets say pin #2 is on and I want to turn pin #3 on. I would have to issue <?php exec("/home/parashell 0x378 2"); ?> to turn pin #3 on, but that would turn off pin #2. If I could pass the "1" from the "pin" command I could add it to the "2" and give it the command with a variable as "3".

 

Thanks in advance for any help you can give. I hope I explained it ok and didn't confuse everyone.

 

 

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

  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

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.