473,233 Members | 3,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,233 software developers and data experts.

Serial Port Problems

I'm trying to send data over the serial port using PHP and Serproxy.
I downloaded Serproxy from
http://www.lspace.nildram.co.uk/freeware.html. From the manual page at
http://www.php.net/function.fopen I was able to find sample code using
Serproxy and directly opening the serial port. My application
requires the use of multiple serial ports on other computers so I'm
left with only Serproxy.

The code I am using is"

$fp = fsockopen ("192.168.0.20", 5331, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)";
} else {
$e = chr(27);
$string = 'string text here';
echo $string;
fputs ($fp, $string );
fclose ($fp);
}
I am able to run the program fine and I see the connection being
displayed on the Serproxy display, however then it fills the buffer on
the RS232 link and the whole string is not transferred over. I
believe what is missing is some type of code that sets the xon to on.
For instance using fopens the line is:

`mode com1: BAUD=9600 PARITY=N data=8 stop=1 xon=off`;
$fp = fopen ("COM1:", "w+");

Is there anyway to turn xon ON using PHP and Serproxy, or another
solution?

Another thought that just came to me is in the sample code they put $e
throughout the string, which is an escape character, perhaps using
that before the buffer fills up?

--
Thanks in advance
Blaine Hilton
Jul 16 '05 #1
3 16495
Thanks for the idea. I would appreciate it if you could post your
changes (or email them to me at blaineATblainehilton.com). I was
reading the documentatiion and see that you can turn on or off
hardware handshaking, but didn't see mention of software handshaking,
which I require. Also does your version then interface with PHP? I
didn't see mention of PHP in the docs.

--
Thanks again
Blaine Hilton
http://www.webcalc.net/
On Mon, 04 Aug 2003 08:08:36 +1200, Jochen Daum
<jo*********@cans.co.nz> wrote:
On Fri, 01 Aug 2003 22:46:03 GMT, Blaine HIlton
<bl***************@verizon.net> wrote:
I'm trying to send data over the serial port using PHP and Serproxy.
I downloaded Serproxy from
http://www.lspace.nildram.co.uk/freeware.html. From the manual page at
http://www.php.net/function.fopen I was able to find sample code using
Serproxy and directly opening the serial port. My application
requires the use of multiple serial ports on other computers so I'm
left with only Serproxy.


Hmm. I spent a lot of time with serproxy and fopen in the last two
weeks and I'm greatly dissappointed. I couldn't manage to let it run
in the background (which might be a lack of unix skills), but the main
problem were the php socket functions. They don't seem to be very
reliable (also have a look at bug reports) and there seems to be no
function, that polls the serial port and doesn't hang, if there's no
data. Ergo, you're buggered.

Instead I stripped down SMSTools

http://www.isis.de/members/~s.frings/

to a tool that sends only an AT command to the serial port with a
timeout. That worked much better. I can post it to you, if you want.

HTH, Jochen


Jul 16 '05 #2
Hi Blaine!

On Sun, 03 Aug 2003 22:20:20 GMT, Blaine HIlton
<bl***************@verizon.net> wrote:
Thanks for the idea. I would appreciate it if you could post your
changes (or email them to me at blaineATblainehilton.com). I was
reading the documentatiion and see that you can turn on or off
hardware handshaking, but didn't see mention of software handshaking,
which I require. Also does your version then interface with PHP? I
didn't see mention of PHP in the docs.


I just call the program I build with shell_exec(), works fine. I'll
send the zip to you and anyone who's interested.

Jochen

--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Swatcat | last post by:
I have a device that send to my computer information by serial com port. The comunication parameters are: PORT: COM 1 Bits per second: 9600 Data bits: 8 Parity: None (0) Stop bits:1 How...
13
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have...
1
by: David | last post by:
I have written an application in VB.NET 2003 that uses the SAX serial component for RS232 communications with hardware. The program sets up 2 serial ports so that it can talk to 2 different...
0
by: Daniel | last post by:
Ive used the New Serial Port Namespace in Net Framework 2 to write a Serial Port Monitoring Application. Basically the program opens the serial port and listens for any data that is received. It...
38
by: shussai2 | last post by:
Hi, I am trying to access Serial Port in XP. I am using Dev-C++ IDE that uses Mingw as a compiler. I just want to know how I can open up serial port on COM1 and write some data. I have searched...
7
by: davetelling | last post by:
I'm a newbie that is still struggling with OOP concepts & how to make things work they way I want. Using Visual C# Express, I have a form in which I added a user control to display a graph, based...
2
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the...
2
by: colin | last post by:
Hi, Im having a tiresome amount of trouble with using a bluetooth serial link. The receiving end is a bluetooth-rs232 module conected to my embeded system. The PC has a little usb bluetooth...
3
by: naveen.sabapathy | last post by:
Hi, I am trying to use virtual serial ports to develop/test my serial communication program. Running in to trouble... I am using com0com to create the virtual ports. The virtual ports seem to...
4
by: JDS | last post by:
I have an application that interfaces with a USB device using the .Net serial port. The code works fine, displaying live data on the screen; that is until the USB lead is pulled out from the PC...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.