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 Code:
`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!
__________________
"Computer games don't affect kids. I mean, if Pacman affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music..."
|