Arduino Delphi Serial Communication Tutorial
- - - - - - - - - Delphi tutorial: serial comms, i.e. Using the COM port Bi-directional Communications 'Master'/'Slave' two computer system This has good information, and a search button at the bottom of the page Please don't dismiss it because it isn't full of graphics, scripts, cookies, etc! I am old fashioned. I disavow any responsibility for things you may elect to do.
Since serial communication is well documented and widely accepted, this resulting in that interfacing arduino boards to other 'smart' system very easy. However, each serial port will consume a pair of digital pins.
In particular, I disavow any responsibility for any consequences arising from connections you make between devices. You can't just plug 'anything' into your computer or anything else! In particular, make sure that you aren't assuming that an RS-232 interface can be connected directly to, say, an or BASICstamp, or PIC or other. There are notes on some of those issues on, for those of you who need them. Enough 'lawyer feeding'.
Let's turn to the Fun Stuff. If you have already read my page 'dt4r' (the illustrations just a little way down the page will be familiar), you can that isn't duplicated THERE! This is one of the more advanced tutorials in a series which shows you how to link two devices using serial comms. In the tutorials, the 'devices' are a Windows PC running programs written with Delphi and an.
However: Either device could be replaced by another. Many of the issues discussed here are general, but I find that principles are best understood when backed up by examples of their application. If you want to know more about the source and format of these pages. It may be easier to read this if you re-size the window, so that it does not use the full width of your screen. The Delphi sourcecode is available for download. The Arduino sourcecode is presented here in full, and you can copy it and paste it into your Arduino development environment for compilation and upload to your Arduino.
This page are a bit rough and ready. Explanations are sketchy. But the code DOES work.
I'll try to come back to this and improve it later. Challenge Before I present the tutorial: A challenge for you: If you are an advocate of another language, write whatever is needed to connect a PC (or other device) to the Arduino with switch and LED and Arduino program as presented here. In other words, replace what is plugged into the Arduino, but leave the Arduino side of things as it is in the essay below. If you succeed, and publish the details, with full sourcecode for the language of your choice, I would be glad to post a link to your work here,.
Two computers; one system For many years, for a number of different reasons, I've wanted to hook a microprocessor to a 'big' computer, and have them talk to one another. These days (August 2010) I am using the wonderful Arduino for microprocessor projects, and a Windows XP computer for my 'main' work. The material below could be used with other devices. In particular, if your objective is to connect some serial device to a 'big' PC, you will find helpful material, I hope. In the diagram below, if you assume that the 'some serial device' is a PC, you see two PCs attached to the Arduino. The one on the left is there for when you are setting up the Arduino to do whatever you want it to do with the other PC.
It would normally unplugged, taken away after the system had been built. The set up above is pretty general. Even without restricting what it implies, you can have two scenarios. In order to explain the scenarios, I need to say what I mean by 'Master' and 'Slave' in the rest of this essay. A 'master' device is in charge. The 'slave' device will 'speak when spoken to'.
It may get on with various things when it isn't commanded by the master to be doing other things, but it will not 'come up' on the serial channel, aka 'serial link' between master and slave unless the master has told it to. The master may 'speak' to the slave in an imperious manner, just issuing a command, and assuming the slave will execute it without any reply. If, for instance, there was an LED attached to the slave, the master might send a 'turn LED on' command'. Or, the master might 'say' 'Turn on the LED, and tell me that you've done it.'