Home » Developer & Programmer » Forms » Reading data from Serial Port. (Oraclr Forms6.0)
Reading data from Serial Port. [message #354508] Mon, 20 October 2008 01:45 Go to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

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 #354520 is a reply to message #354508] Mon, 20 October 2008 03:13 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Such a question has already been asked on this forum. Please, search the board and read what's been said. Perhaps you'll find something interesting.
Re: Reading data from Serial Port. [message #354532 is a reply to message #354520] Mon, 20 October 2008 03:34 Go to previous messageGo to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

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 #354914 is a reply to message #354532] Tue, 21 October 2008 23:44 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Is this working? What result do your get when you run it?

David
Re: Reading data from Serial Port. [message #354924 is a reply to message #354914] Wed, 22 October 2008 00:10 Go to previous messageGo to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

Dear David,

The code is not working.When i try to get the value of OLE it gives an error and this line is handeled with exception.

hold := OLE2.GET_num_PROPERTY(CommHandle, 'PortOpen');

Then i get the Non Oracle Error:
-305500 305500 Non Oracle Exception


The way i used to get data from the serial port is right or there is anything wrong.

Waiting For you are Suggestions

Thank U
Manoj
Re: Reading data from Serial Port. [message #354931 is a reply to message #354924] Wed, 22 October 2008 00:25 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
The code you posted previously has obvious errors and could not have worked.

Please post the code that you are using. Also, please use 'code' tags around that code.

David
Re: Reading data from Serial Port. [message #354932 is a reply to message #354931] Wed, 22 October 2008 00:29 Go to previous messageGo to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

If u dont mind Should i upload the form.
Re: Reading data from Serial Port. [message #354939 is a reply to message #354932] Wed, 22 October 2008 00:40 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
You say that your form is only failing in one place. Just post that code (between 'code' tags). Most people only have one version of Forms Developer available to them and it may NOT be the version that you are using.

David
Re: Reading data from Serial Port. [message #354940 is a reply to message #354932] Wed, 22 October 2008 00:41 Go to previous messageGo to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

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 1775 times)
Re: Reading data from Serial Port. [message #354943 is a reply to message #354940] Wed, 22 October 2008 00:45 Go to previous messageGo to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

I am using Forms 6i.
And i know that everyone is using different form.
u can Open the form and check that where i am wrong.
I am using OLE first time so there may be any error so please have a look.


Thanks

Re: Reading data from Serial Port. [message #355199 is a reply to message #354943] Thu, 23 October 2008 01:58 Go to previous messageGo to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

Desperately waiting for your suggestions.

[Updated on: Thu, 23 October 2008 01:59]

Report message to a moderator

Re: Reading data from Serial Port. [message #355376 is a reply to message #354943] Thu, 23 October 2008 19:28 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
You say 'the code is not working'. Do you really mean that the code does not compile? Because as sure as whatever, it doesn't compile for me. You have a '(' missing in the first active line.

David
Re: Reading data from Serial Port. [message #356523 is a reply to message #355376] Fri, 31 October 2008 00:15 Go to previous messageGo to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

The Form i have attached is compiling and doesnot give any error.
But the form is not giving the desired output.
Please have look once again in the form.

Thank U
Manoj
Re: Reading data from Serial Port. [message #356684 is a reply to message #356523] Sat, 01 November 2008 00:30 Go to previous messageGo to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

Dear All,

Can anybody please tell me the exact way to read the data from serial port in details.
I am in need and my deadline is very close.I need it very urgent.
Need you are help.

Thank U
Manoj
Re: Reading data from Serial Port. [message #356727 is a reply to message #356684] Sat, 01 November 2008 08:35 Go to previous messageGo to next message
amkalisa
Messages: 1
Registered: November 2008
Location: Muscat
Junior Member
Hi,

Did you find the solution???

Thanks.
Re: Reading data from Serial Port. [message #356871 is a reply to message #356727] Sun, 02 November 2008 23:04 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Search this forum for 'serial'. Is is a common question.

David
Re: Reading data from Serial Port. [message #358366 is a reply to message #356727] Mon, 10 November 2008 22:25 Go to previous messageGo to next message
manojbawage@gmail.com
Messages: 18
Registered: October 2008
Location: Mumbai
Junior Member

Till the date i wont get any solution.
Even i searched the forum but get unsuccess to complete the task.
Is there any Sample form that works successfully with Serial Port data communication.


Thanks
Manoj
Re: Reading data from Serial Port. [message #387879 is a reply to message #354508] Sat, 21 February 2009 04:20 Go to previous messageGo to next message
naeemsheeraz
Messages: 3
Registered: August 2007
Junior Member
I also facing same problem.
Re: Reading data from Serial Port. [message #388256 is a reply to message #387879] Tue, 24 February 2009 00:57 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Naeem,

Have you tried using PM to contact each of the Original Posters of the various 'serial' threads?

David
Re: Reading data from Serial Port. [message #388310 is a reply to message #388256] Tue, 24 February 2009 03:49 Go to previous messageGo to next message
naeemsheeraz
Messages: 3
Registered: August 2007
Junior Member
No, Any sample coding...
Re: Reading data from Serial Port. [message #415718 is a reply to message #358366] Wed, 29 July 2009 00:17 Go to previous messageGo to next message
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 #415949 is a reply to message #415718] Wed, 29 July 2009 22:30 Go to previous messageGo to next message
naeemsheeraz
Messages: 3
Registered: August 2007
Junior Member
Yes we solved all problems, now our module working effeciently.
We buy solution(data reading from serial port Forms 6i) form third party.

[Updated on: Wed, 29 July 2009 22:37]

Report message to a moderator

Re: Reading data from Serial Port. [message #415959 is a reply to message #415949] Wed, 29 July 2009 23:17 Go to previous message
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 ?
Previous Topic: adding an urdu filed in form
Next Topic: compilation error
Goto Forum:
  


Current Time: Fri Sep 20 09:51:12 CDT 2024