This varies considerably from 16-bit code as access to the communications ports is achieved through file handles. This document gives a brief introduction to serial communications under Delphi 2.0 - it does not cover event-driven applications. Opening the serial port. First step is to open the communications device for read/write.
![]()
I do have a comm port setup in device manager as any otherport. I tried the capture demo. I tried to simply change the port number on VAComm, and tried to change protocols using the VAconfig dialog. The demo works fine on standard com port 1 as an example. I would think itshould behave the same on a defined USB to Serial comm port 20 or any other port number with the same setup, however it cannot access that port without error.I amusing Delphi 7 with my TMSAsync component set under XP Pro. I am beginning to wonder if there is a problem with developing under a 32 bit environment and running under 64 bit systems somewhere with USB drivers or something else may be a problem.
I ran into a similar issue a couple of years ago. My only resolution was to stay with standard comm ports that I had done with AsyncPro, which I can no longerdo unless it has made a come back. My application is fairly simple. I am reading data from weigh scales.
Unfortunately this is kind of a one time application, which makes it hard for me to do justify upgrades to systems all around. So I need a solution with what I have now.Any comment is appreciated that will hopefully lead me in the right direction.John P.van de Geyn John. This message may be a repeat as something seemed to go wrong with my post. I am rewriting. Anyway I don't think it is a cable issues since I can use Putty or other Terminal programs and run off my USB to serial com port. I can see all scale data coming in.
I must be doing something wrong or not using the right components correctly. I cannot run the TMS demo Capture program, which the connection seems OK on the others but does not bring in data after trying various mods. I am wondering if I can get sample demo that would capture some data from a scale. Here is working code from from AsyncPro if that helps, which I would like to put into TMS Async 32, and of course need to run of USB to Serial com ports.constMAXCHARS = 20;VALIDCHARS = '0'.' Z' ;varI, X: Integer;C: Char;S: String;LastError: Integer;beginLastError:= errSuccess;setlength( S, MAXCHARS );// Collect the ASCII characters that come back,// discarding the STX and ETX characters along// the way.I:= 0;X:= 0;while ( ( X 0 ) thenS:= copy( S, 1, X-1 );// ShowMessage('Scale is reading:' + S);LabelWeight.Caption:= S;end;van de Geyn John. I am still having trouble with this.
I am wondering if you or anyone else may be able to help me. My AsyncPro has failed me since I upgraded from version 4.6.to 5 without any code changes! I think I need to re-write or see all of this code above somehow with TMS Async32 since there are indications of it working with USB to serial. But first test on standard ports as I can still resort to serial cards. I am using Delphi 7under an XP Pro and Win 7 systems, and of course have purchased TMS products.Right now my main goal seems to be just capturing a whole string with a start and end character into a var, label or some other container, and to get that string I need to send a 'W'+#13 to the scale.
![]()
You would think that would be easy but I am missing something simple, which of course I am driving a new wheel here.Johnvan de Geyn John. Hi John,From what I read, I likely just need a demo using VaCapture with VaComm. Once I get my characters into a container of some sort. (prefer data before the start and end characters). I can later do what I need to do with that string.
I would think this would be just one or two lines of code.I can get data into a label caption. I was just using the demo terminal program with VAComm. However that data is a continuous stream and not between the start and end characters, or a fixed length, which I also use a timer to slow down to see.In the future it would be nice to see a property or way to ignore characters on a capture, such as the start and end, alpha characters, or any other extended characters. That would make for a nice scale or bar code reader as an example.There are no demos and not much information on the use VaCapture, which I believe is all I need to get going.Thanks for you help.John P.Rottmann Heinz. Hello,ran into a similar Problem when trying to read from the native USB port from the Arduino Due.I got data with the Arduino IDE, with a Serial logger, but was unable to get some with the capture demo. On the other Hand I was immediatly able to read data from the programming port of the Arduino DUE (what is a 'regular' COM port on the PC side). After playing a while with the Settings the reason was quite simple:The USB virtual COM port for this device (Arduino Due) Needs DTR or RTS enabled - may be that solves your Problem too (if it still exists).Rottmann Heinz.
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |