Delphi tutorial: serial comms, i.e. Using the COM port Bi-directional Communications. That should read 'Arduino program 'SerialArdAsSlave2' suitable for slave.' It defines a communication protocol and a. Serial protocol. Delphi in the master, what is in the Arduino could be used. I know there is a guy that has been able to read values from the arduino in delphi by using. Arduino and Delphi. To run once: // set up Serial library. Hi all, I'm trying to read incoming data from my motorcycle's K-line, which is a bi-directional serial line. I found an individual who had done this very thing, so I basically followed almost exactly what he did, with a few adjustments: The bike communicates with a 12v signal, and he used a special chip to convert that data to 5v so the Arduino would like it. (L9637) I tried to order a similar chip, but I was not working for me. I ended up using a Zener clipping circuit into a schmitt trigger (74HC14) to create the 5v output to send to the Arduino. The problem is it actually works.only some of the time. At first I thought I had messed up the circuit between tests, so I took a picture of it the last time it was working. The circuit is simple enough that I don't think I am 'breaking' it. I attached 4 images: 1) what I get from the serial monitor when things are working correctly 2) what I get from the serial monitor currently, plus the code 3) a drawing of my circuit 4) a crappy photo of my breadboard I'm sure this could be a number of things. I have an oscilloscope that has shown me a few things. The signal from the bike is solid. I can see the square wave perfectly. The clipping circuit seems to be working properly, however when I hook power or ground from the arduino into the circuit, there seems to be a sine wave of noise that 'adds' itself to the square serial signal. I am teaching myself electrical theory from the ground up, so when it comes to electron flow and where I should be grounding things I may not have the best ideas for circuits. Of course, sorry about that. Code attached. I've also attached four images of my oscilloscope--each have an image of the circuit with them showing where it was attached. The first three images did not have the arduino positive, ground, or pin 10 connected (as illustrated). From my limited understanding, the ground side of the zener clipper circuit is running to IN to the schmitt trigger and the K-line side is running to GND because it inverts the logic of the serial signal. You can see this in the images I attached. I could be wrong, but I think it makes sense. Why have you such a strange baudrate for SoftwareSerial - 16129. Why not a standard baud rate - 9600 or 19200? I don't know what SoftwareSerial would make of such a number, and an odd number at that. How come you have 3 fairly sensible traces but the one going into the Arduino is all screwed up with a sine wave? What is causing the sine wave? That must be eliminated. Leave the 'scope ground where it is for that test and re-run the other tests - perhaps there is a poor connection somewhere. Or maybe it won't work with the GND and k-line the wrong way round. If you need to invert a signal just feed the output through a second schmidt trigger on the 74HC14. The normal serial ttl communication protocol idles HIGH and a 0 is LOW and a 1 is HIGH.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2018
Categories |