Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not receiving all character correctly #14

Open
GoogleCodeExporter opened this issue Dec 1, 2015 · 2 comments
Open

Not receiving all character correctly #14

GoogleCodeExporter opened this issue Dec 1, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Hi,

I'm just testing this class as I need to transmit and receive data from a LED 
controller. But for now, I'm doing test with a null-modem cable plugged to COM7 
and COM8, via USB-to-serial adapter.
I'm trying some simple transmission but notice that all characters are note 
received well. Some needs to be uppercase, the other lowercase.
Here is the "good" spelling for having good transmission:
ABcDefGHijKlMNoPqrStUVwxYZ
If I send "a" instead of "A", I receive a "á". All "non-working" characters 
are with accents.
I check the receiving string with a Tera Term terminal connected on COM7, and 
my php script is connected on COM8.
All the transmission are good when using 2 terminals (1 on COM7, 1 on COM8), 
but not with the script

What steps will reproduce the problem?
1. using the example.php, just replace $serial->sendMessage("Hello !"); with 
$serial->sendMessage("Bazinga!");

What is the expected output? What do you see instead?
Expected result : Bazinga!
see instead: Báúiîçá!

What version of the product are you using? On what operating system?
Last version from SVN read only, on Win7 x64, with PHP 5.3.13

Please provide any additional information below.
Got the same result while using PHP-Cli, so Apache not involved

Thanks :)

Original issue reported on code.google.com by [email protected] on 6 Nov 2012 at 8:36

@GoogleCodeExporter
Copy link
Author

Hi dude did you ever manage to fix this? Having the exact same issue.

Original comment by [email protected] on 20 Aug 2013 at 4:24

@GoogleCodeExporter
Copy link
Author


    function rs232init($com,$bautrate)
    {
    `mode $com: BAUD=$bautrate PARITY=N data=8 stop=1 xon=off`;
    }

    function send($comport,$char)
    {

         $fp = fopen ("$comport", "w+");
         if (!$fp)
          {
             echo "not open for read";
          }
        else {
                fputs ($fp, $char);
                 fclose ($fp);
                }
    }

    function read($comport2,$sek)
    {

       $buffer = "";

       $fp2 = fopen ("$comport2", "r+");
         if (!$fp2)
         {
       echo "port is open for read";
       }
    else
      {
      sleep($sek);
             $buffer .= fgets($fp2, 4096);
            }
          return $buffer;
          fclose ($fp2);
}


rs232init("com2","9600");
send("com2","3"); 
$a = read("com2","2"); 
echo $a; 

Original comment by [email protected] on 2 Aug 2014 at 9:29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant