I am looking to build software which communicates to a piece of hardware which I do not have in my possession at this time, the hardware uses a serial connector utilising the RS232 protocol. I really want to start writing the code for my desktop application but as I dont have the hardware to test the data I am sending it is very difficult so I was hoping I could substitute my Arduino to receive this data via the standard Arduino USB connection with the hope of turning on and off a light or outputting the data into the serial monitor... is this possible to:
send/receive RS232 data via standard PC->USB->arduino ?
does this make sense at all to do this as a prototype and has anyone got any examples of doing this by any chance ?
The only difference between the signals at the Rx and Tx pins of an Arduino and a proper RS232 connection is the voltage levels. You would normally use something like a MAX232 to convert between the Arduino's TTL voltage levels and the higher RS232 voltage levels. There should be no need for a change in the code.
How do you plan to connect your Arduino to this other device? Using an Arduino with some spare HardwareSerial ports (such as a Mega or a Micro) would probably make things easier because you could use the USB connection to your PC for debug messages. You could use SoftwareSerial to create an extra serial port on an Uno but it is very much a second-best option.
You should probably check if the RS232 device needs signals on any of the control lines such as DTR and RTS (never sure which is which) as the Arduino USART does not handle them. You can probably emulate them with your program.
As the Arduino provides a standard serial device on a PC it's possible to use it instead of any other serial hardware.
Using the serial monitor does not work because you want to use the serial interface to simulate your other hardware. So depending on what that mysterious other hardware should do it might be possible to light up some LED or write to and LCD display depending on what you receive on the serial interface.
You should have an exact specification of that mysterious hardware to be able to simulate it using an Arduino, otherwise you might program for your simulation but that program fails afterwards on the real hardware.
I am looking to build software which communicates to a piece of hardware which I do not have in my possession at this time, the hardware uses a serial connector utilising the RS232 protocol. I really want to start writing the code for my desktop application but as I dont have the hardware to test the data I am sending it is very difficult so I was hoping I could substitute my Arduino to receive this data via the standard Arduino USB connection with the hope of turning on and off a light or outputting the data into the serial monitor... is this possible to:
send/receive RS232 data via standard PC->USB->arduino ?
does this make sense at all to do this as a prototype and has anyone got any examples of doing this by any chance ?
How extensive is the documentation for the mystery device? Do you have any information on what is expects and what it sends?
I was in the same situation as you in 1980 and was building a communications front end processor. I used a SYM-1 single board computer and programmed responses in Basic. Started sending one byte one way and then increased as I became better acquainted with what I was doing.
You can do the same thing with a second Arduino acting in place of the mystery device. If you don't have a data monitor, you need to get a second PC to connect to the second Arduino to see what is being sent and received.
Doing what you want with one device only will lead to early death!