Jump to content

Writing/Reading COM Port


Recommended Posts

Hello everyone, I have read the basic tutorial and googled about this topic, but I'm confused.

 

The context is: I'm sending simple characters from a microcontroller to a virtual terminal in my PC. The transmission protocol is RS232 (9600 baud, No parity, 8 bits, 1 stop bit) and I need to be able to capture the messages to later insert them into a database.

 

I have read something about a paid library but as I said I'm new to web programming.

 

Right now, I need to figure out how to detect an incoming character and save it.

 

Thank you!

Link to post
Share on other sites

I doubt PHP would be the tool for that. The major use case for PHP is that it runs on a web server and only executes when someone makes a request for a PHP script. It wouldn't sit there and monitor a COM port, for example. It could, but that's not really what it's for. You might want to look into using C/C++ or Java to write a little console application that will sit there waiting for COM traffic. That application could save things to a database which PHP could then read to show on a web site.

Link to post
Share on other sites

I doubt PHP would be the tool for that. The major use case for PHP is that it runs on a web server and only executes when someone makes a request for a PHP script. It wouldn't sit there and monitor a COM port, for example. It could, but that's not really what it's for. You might want to look into using C/C++ or Java to write a little console application that will sit there waiting for COM traffic. That application could save things to a database which PHP could then read to show on a web site.

 

I see, so what combination of languages can I use? C++ to read it and save it into a database? Is it possible to combine C++ and MySQL?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...