Reading data from Serial Port. [message #354508] |
Mon, 20 October 2008 01:45 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
manojbawage@gmail.com
Messages: 18 Registered: October 2008 Location: Mumbai
|
Junior Member |
![manojbawage@gmail.com](/forum/theme/orafaq/images/google.png)
|
|
Dear All,
Can anybody Help me to read the data from serial port.
I am working on Forms 6i and needs some help on Getting data from serial port.
I have a weigh scale connected to my machine on comm port.
I need to read the data from serial port.I am trying to do the same using the MSCOMM but getting errors.
If any one has any idea about this please Guide me.
It is very urgent for me.
Thanks & Regards
Manoj Bawage
|
|
|
|
Re: Reading data from Serial Port. [message #354532 is a reply to message #354520] |
Mon, 20 October 2008 03:34 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
manojbawage@gmail.com
Messages: 18 Registered: October 2008 Location: Mumbai
|
Junior Member |
![manojbawage@gmail.com](/forum/theme/orafaq/images/google.png)
|
|
I have tried to do the Way told.I am using MSCOMM in my form and trying to i will paste what code i have using to get it.
*****************************************************************
Declare
CommHandle ole2.obj_type; -- to hold the interface pointer
hold number;
NUM1 number;
string1 Varchar2(2000);
string2 OleVar;
Begin
CommHandle :=forms_ole.get_interface_pointer'block3.OLE_CONTROL4');
Message(CommHandle);Message(CommHandle);
OLE2.SET_PROPERTY(CommHandle, 'CommPort', 1);
--num1:=Get_Ole_Num(CommHandle,4);
-- try to close COM2, in case it was open for some
begin
OLE2.SET_PROPERTY(CommHandle, 'PortOpen', 0);
exception
when others then
Message('port open');Message('port open');
end;
-- Set device to 9600 baud, no parity, 8 data, and 1 stop bit.
OLE2.SET_PROPERTY(CommHandle, 'Settings', '9600,N,8,1');
-- Open the port. 0 = FALSE, -1 = TRUE
OLE2.SET_PROPERTY(CommHandle, 'PortOpen', -1);
-- find out if the com port has opened successfully. 0 = FALSE, -1 = TRUE
--hold := OLE2.GET_num_PROPERTY(CommHandle, 'PortOpen');
Begin
OLE2.set_PROPERTY(CommHandle,'InBufferSize',1200);
--string2:=Get_Ole_Var(CommHandle, 26);
Exception
When Others Then
:block3.op:='Error In Reading';
Message('1'||SQlcode||sqlerrm);
Message('1'||SQlcode||sqlerrm);
End;
OLE2.SET_PROPERTY(CommHandle, 'InBufferCount', '0');
Message('Buffer Cleared');Message('Buffer Cleared');
Exception
When Others Then
Message(SQlcode||sqlerrm);Message(SQlcode||sqlerrm);
End;
*****************************************************************
|
|
|
|
|
|
|
|
Re: Reading data from Serial Port. [message #354940 is a reply to message #354932] |
Wed, 22 October 2008 00:41 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
manojbawage@gmail.com
Messages: 18 Registered: October 2008 Location: Mumbai
|
Junior Member |
![manojbawage@gmail.com](/forum/theme/orafaq/images/google.png)
|
|
I have taken a OLE CONTROLLER On a canvas and referanced it to the MSCOMM.OCX.
Then From IMPORT OLE CONTENT LIBRARY I imported MSCOMM1.
Then I have taken a PUSH BUTTON And written the code on the event.
***************CODE*******************************
Declare
CommHandle ole2.obj_type; -- to hold the interface pointer
hold number;
NUM1 number;
string1 Varchar2(2000);
string2 OleVar;
Begin
CommHandle :=
forms_ole.get_interface_pointer'block3.OLE_CONTROL4');
Message(CommHandle);Message(CommHandle);
OLE2.SET_PROPERTY(CommHandle, 'CommPort', 1);
--Num1:=OLE2.GET_num_PROPERTY(CommHandle, 'Commport');
/* try to close COM2, in case it was open for some reason.
0 = FALSE, -1 = TRUE*/
begin
OLE2.SET_PROPERTY(CommHandle, 'PortOpen', 0);--port open
exception
when others then
Message('Port is open');Message(' ');
end;
-- Set device to 9600 baud, no parity, 8 data, and 1 stop bit.
OLE2.SET_PROPERTY(CommHandle, 'Settings', '9600,N,8,1');
-- Open the port. 0 = FALSE, -1 = TRUE
OLE2.SET_PROPERTY(CommHandle, 'PortOpen', -1);
--hold := OLE2.GET_num_PROPERTY(CommHandle, 'PortOpen');
OLE2.set_PROPERTY(CommHandle,'InBufferSize',1200);
OLE2.SET_PROPERTY(CommHandle, 'InBufferCount', '0');
Exception
When Others Then
Message(SQlcode||sqlerrm);Message(SQlcode||sqlerrm);
End;
-
Attachment: manoj1.fmb
(Size: 268.00KB, Downloaded 1798 times)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Reading data from Serial Port. [message #415718 is a reply to message #358366] |
Wed, 29 July 2009 00:17 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
RNSidhu
Messages: 8 Registered: July 2009
|
Junior Member |
|
|
Hi Manoj,
Were you able to implemengt your requirement. I am trying to implement the same code your have posted. Please let me know how you resolved your issue of 305500 Unhandled Exception. I need this urgently.
|
|
|
|
Re: Reading data from Serial Port. [message #415959 is a reply to message #415949] |
Wed, 29 July 2009 23:17 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
RNSidhu
Messages: 8 Registered: July 2009
|
Junior Member |
|
|
Hi ,
Any idea how this error is resolved or how this is implemented in your code. Actually the exception is coming at OLE2.GET_NUM_PROPERTY('CommHandle') in forms 6i so i actually wanted to know whether this actually works in Forms 6i ?
|
|
|