Jump to content

Writing/Reading COM Port


luisda2994

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 comment
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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...