[Php-it] Scrivere su porta seriale

giuseppe at arsnet.it giuseppe at arsnet.it
Fri Jul 7 09:21:27 CEST 2006


Ho necessità di spedire dei dati via seriale con php (per comandare un
registratore di cassa)

E sul manuale ondine ho trovato questo codice:

 <MailTo:giuseppe at arsnet.it> 

// Use this code to write directly to the COM1 serial port

   // First, you want to set the mode of the port. You need to set

   // it only once; it will remain the same until you reboot.

   // Note: the backticks on the following line will execute the

   // DOS 'mode' command from within 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

        {

        $e = chr(27);

        $string  = $e . "A" . $e . "H300";

        $string .= $e . "V100" . $e . "XL1SATO";

        $string .= $e . "Q1" . $e . "Z";

        echo $string;

        if(fputs ($fp, $string )) echo"<br>OK</br>";

        fclose ($fp);

        }

 

In questo momento non ho un registratore di cassa per testarlo, mi chiedevo
se qualcuno di voi l’avesse già provato oppure avesse soluzioni alternative.

 

Grazie Giuseppe




---
avast! Antivirus: In partenza messaggio pulito.
Virus Database (VPS): 0627-2, 06/07/2006
Controllato il: 07/07/2006 9.21.28
avast! - copyright (c) 1988-2006 ALWIL Software.
http://www.avast.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ziobudda.net/pipermail/php-it/attachments/20060707/2ef75eaf/attachment-0001.html


More information about the Php-it mailing list