
09-25-2007
|
| Administrator
Join Date: Jun 2007
Posts: 3,729
BRL$: 31,923.30 Thanks: 0
Thanked 4 Times in 4 Posts
Rep Power: 403 | | fopen.. and keeping it that way! Hi all, Thank you for looking at my post. I haven't much to offer this community but I'll help whenever I can. Right now I have a rather complicated problem. Im using php open a com port, write to it twice, then close the port and navigate away. The problem is, the com device I have requires NINE seconds after it is opened to be "Ready" to be written too. So, my code looks like this: PHP: --------- `mode com1: BAUD=9600 PARITY=N data=8 stop=1 xon=off`; $fp = fopen ("COM1:", "w+"); if (!$fp) { echo "Uh-oh. Port not opened."; } else { sleep(9); $string = "string" fputs ($fp, $string ); fclose ($fp); } header( 'Location: http://frontdist.net/gc/getcard.html' ) ; --------- So, here's what is happening. OPEN COM1 WAIT 9 SECONDS WRITE STRING TO COM1 CLOSE COM1 Once com1 is open, I can send commands as often as I like, but that 9 seconds is a long time when you're stuck waiting! I'd like to be able to open COM1 once, then just write to it as I need. This script is run everytime I need to write to COM1 (Its a remote power switch), so waiting 9 seconds is not an option. Eventually this script, in conjunction with a card-swipe and some database scripting will allow be to access restricted area's using a card. Thanks so much for your help! To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. | |
__________________ █ High Quality To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
█ Powerful To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
█ To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. | | | |