joda1250
asked on
How do I communicate with serial port in PowerBuilder
In this app, I have a hardware device that is sending a byte in through the serial port, I have to "listen" and determine when that byte comes in, grab the data and send a request back. I would like to know how I can code to determine that data has just come in through COM 1. The hardware I am communicating with does not offer an Active-X control for me.
ASKER
Thank you for the assistance on this.
I tried to import your uo script but get an error message "illegal data type st_overlapped" Do you have the export for this? I assume it is a structure?
I do have the mscomm32.ocx on my PC, when I try to add an OLE object using it, I try CREATE FROM FILE and it does not give me the OLE properties I expect. So I try to use INSERT CONTROL and get an error message "License file required"
I looked the links you give me above, some of them lead to dead ends and other one has the exported uo which gives me same error on import.
Once I do make communication, all I need to do is listen for data to come in through COM1 and read it byte by byte.
Thank you for your time.
I tried to import your uo script but get an error message "illegal data type st_overlapped" Do you have the export for this? I assume it is a structure?
I do have the mscomm32.ocx on my PC, when I try to add an OLE object using it, I try CREATE FROM FILE and it does not give me the OLE properties I expect. So I try to use INSERT CONTROL and get an error message "License file required"
I looked the links you give me above, some of them lead to dead ends and other one has the exported uo which gives me same error on import.
Once I do make communication, all I need to do is listen for data to come in through COM1 and read it byte by byte.
Thank you for your time.
ASKER
I tried to register the mscomm32.ocx and got a successful message. Still did not help the license issue. Then I tried to unregister it and re register it. No good still.
joda
joda
Hi,
sorry abt the delayed reply... kinda lost the thread....
st_overlapped is a structure we need when writing to the communication ports. It is defined as follows:
$PBExportHeader$st_overlap ped.srs
global type st_overlapped from structure
long Internal
long Internalhigh
long offset
long offsethigh
long hevent
end type
Please refer:
http://eric.aling.tripod.com/PB/tips/pbtip12.htm
Cheers,
Rosh
sorry abt the delayed reply... kinda lost the thread....
st_overlapped is a structure we need when writing to the communication ports. It is defined as follows:
$PBExportHeader$st_overlap
global type st_overlapped from structure
long Internal
long Internalhigh
long offset
long offsethigh
long hevent
end type
Please refer:
http://eric.aling.tripod.com/PB/tips/pbtip12.htm
Cheers,
Rosh
ASKER
Rosh, Thank you for the help.
Now anther structure is needed. st_DCB
Thanks,
John
Now anther structure is needed. st_DCB
Thanks,
John
Hi,
i dont see the above structure st_DCB in the code provided by me above.
Please refer the URL http://eric.aling.tripod.com/PB/tips/pbtip12.htm
I dont thing u need anything beyond the code provided there to achieve wat u want in ur original question.
Or,
provide the code ur using.wonder wat st_DCB is???
Cheers,
Rosh
i dont see the above structure st_DCB in the code provided by me above.
Please refer the URL http://eric.aling.tripod.com/PB/tips/pbtip12.htm
I dont thing u need anything beyond the code provided there to achieve wat u want in ur original question.
Or,
provide the code ur using.wonder wat st_DCB is???
Cheers,
Rosh
ASKER
Please see line 142 in the code of your first reply. There it has this variable defined.
st_DCB str_DCB
When I attempt an import on the n_cst_serialcom.sru file, I need to have that strructure defined.
st_DCB str_DCB
When I attempt an import on the n_cst_serialcom.sru file, I need to have that strructure defined.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help Rosh. Greatly appreciated.
you will need the following OCX -->MSCOMM32.OCX
im sure u have it on ur machine already.
Now using OLE u can communicate with ur serial port.
Check the following links for more info,
https://www.experts-exchange.com/questions/20560721/Read-Write-in-ports-COM1-COM2.html
https://www.experts-exchange.com/questions/21349512/HOW-TO-CONTROL-A-CUSTOMER-DISPLAY-DEVICE-USING-COM-PORT.html
Attaching exported objects from below link,
https://www.experts-exchange.com/questions/20876598/accessing-COM-port.html
Hope This Helps...
Cheers,
Rosh
Open in new window