Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PC to PC communication

Status
Not open for further replies.
sorry for asking multiple question , but still I have some question, I understand that what is compiler, assembler , have little bit knowledge about c , assembly. I have been done some project using mircocontroller. I also understand that how does web page create , for the computer A I know I need to create wab page , I need program for computer B that will decode the command and send to usb port.
problem is that how micro controller will receive the instruction using usb , as we know microcontroller work according to the program that store in rom of mcu. we burn hex file into the memory of controller. after that micro controller start to work

computer B receive signal From computer A then computer B decode signal and send to MCU
computer B--- usb ---db9 connector - maxrs232 - microcontroller - relay- motor

how will microcontroller know that computer B are sending data , what should be in a program for microcontroller ?
 
The Arduino treats the USB port as a standard serial device. Hence, data can be sent/received with the serial libraries (embedded in the Arduino IDE, that is, do not have to be included in your sketch). Here is one tutorial which describes communicating over the USB port of the Arduino.

So you want to turn on relay #2? You would be listening on the serial port for data (Serial.available) and then would read the data in, one byte at a time (Serial.read(myChar)). In this example, myChar would be equal to 2 (that is what computer A sent). Your sketch logic would then output a digital value on the pin assigned to relay #2. And then go on waiting for more data to become available.

That is the high level approach.
 
I have created web page , there are two buttons on web page , start and stop still I am writing code for computer B. but the main problem is that communication between computer B to microcontroller. Should I only need program for serial communications of the 8051 with the COM port of the PC.?

Computer B --- USB --- Microcontroller with USB interface.

https://what-when-how.com/8051-microcontroller/serial-port-programming-in-c/
MCU can not communicate directly to computer, so what I do, so that MCU can receive the signal directly from computer B
 
Last edited by a moderator:
I would have thought that computer B would be running web server software and the web page that you wrote resided on computer B. When one of the buttons was actvated (By normal webpage access over the web.) the code in the web page could send a single character via the serial port to the Arduino. If the Arduino recieved a letter "A" (for example.) then it would turn the relay on. If it recieved a letter "B" it would turn the relay off. The Arduino could do the same by sending a character to the web page software which could change a text message on the screen. I do not know how to do this as I have only created web pages using "Microsoft Frontpage" or similar programs. I have never created a web page just by writing html code.
The "Web server in a box" design I mentioned in post #14 could take the place of computer B and the Arduino.
There is also quite a lot of information on the web about using the Raspberry PI as a webserver. Here is one web page that may be of interest to you.

Les.
 
Last edited:
If you can find a machine old enough that it has a parallel printer port for computer B, you could use one of it's output pins to drive the relay, and skip the microcontroller.
 
The communications part is easy. It's called Windows Remote Desktop Connection. It's as if you are seeing the remote computer like you are sitting at it.

Activating a relay can be done with a sound card audio output and a simple circuit to transform the audio output to a drive signal for the relay. An app on the remote computer's desktop can output the audio signal.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top