Getting data in Forms from a weighing bridge through MSCOMM32.OCX [message #554053] |
Thu, 10 May 2012 02:48 |
Sporadic
Messages: 17 Registered: January 2007 Location: Faisalabad
|
Junior Member |
|
|
Dear Oracle Gurus,
I want to get the data from a weighing bridge in Oracle Forms 6i, directly using comm port or serial port.
I am using MSCOMM32.OCX and importing its library, making functions, but couldnot get any solution, It gives me an Oracle Form Error FRM-41344: OLE object not defined for MSCOMMCONTROL in current record. On Clicking ok I got another forms error FRM-40738: Argument 1 to built in Get_OlE_Num cannot be Null.
I had tried to insert object by right clicking it, but the problem still reside.
I had searched this forum for MSCOMM32.OCX, getting data from serial port, CommHandler, MSCOMMCONTROL, etc. for the last week to get the solution. But I couldn't get any solution, I used the form from Manoj, I checked out the OTN Forum also, and google this issue, but failed to get the solution. My form is attached below. If anyone can give me the complete solution, with the form I shall be highly appreciate it, and will be thankful to him.
Please give me some suitable solutions.
Best Regards
-
Attachment: wt.fmb
(Size: 312.00KB, Downloaded 4122 times)
|
|
|
|
|
|
Re: Getting data in Forms from a weighing bridge through MSCOMM32.OCX [message #554444 is a reply to message #554427] |
Mon, 14 May 2012 09:41 |
Sporadic
Messages: 17 Registered: January 2007 Location: Faisalabad
|
Junior Member |
|
|
And finally, I am successful in getting data in the form from serial port and weigh bridge. This error was due to the serial port, is not available on my laptop (basically i was using usb to comm port converter), then I use some other desktop system having builtin serial port.
Then I was facing problem about bit rate, then I connected with hyper terminal, on it, it is also not sending the data, then i contacted vendor, he gave me exact bit rate, on which the weigh scale sending data on the serial port, setting all the parameters I got the data on the form.
Any body need help about it, can contact me on this forum.
Thanks all for helping me.
|
|
|
|
Re: Getting data in Forms from a weighing bridge through MSCOMM32.OCX [message #554677 is a reply to message #554458] |
Wed, 16 May 2012 08:09 |
Sporadic
Messages: 17 Registered: January 2007 Location: Faisalabad
|
Junior Member |
|
|
Yeah, It will be an honor for me to guide the person, who are feeling problem in this.
First I install MSCOMM32.ocx in windows/system32 folder.
Then Make is register with regsvr32 command.
Then open a new form, import Ole library from program menu.
All the procedures and functions are imported.
Then on layout editor, created an ole container, by double clicking I set the OLE class to Mscomm.comm1.lib
Then i right click on the ole object and add mscomm32.ocx control by inserting object.
Create a button, and create timer, (all coding is available in the form)
create a procedure to get the data from comm port, and call it in when-timer-expired trigger.
The most important thing, which kept me in problem was the attributes by which the weigh bridge sent the data to comm port.
This will be available on weigh bridge manual.
Anyways, before running the form, check the hyper terminal, whether it is getting the data from the weigh bridge.
It will also get the data on the same parameters, like bits per second, parity etc.
After confirmation, you can run the form, your form will also getting the data.
In case of problem, you can also share with me, and the form is attached in previous posts is the right form, it will get the data, only set the parameters according to the parameters of the weigh bridge.
Regards.
|
|
|
|
|
|
|
|
|
|
|
Re: Getting data in Forms from a weighing bridge through MSCOMM32.OCX [message #586604 is a reply to message #583699] |
Fri, 07 June 2013 17:43 |
|
CARLOSTHX
Messages: 5 Registered: March 2013 Location: Cancun
|
Junior Member |
|
|
Sorry for the delay & my poor english! Well, first step: Create a java class using javax.comm, in my case i use the "$" protocol for my scale simulator. Then create a jar package with this class and import it in your form module.
Caution: you should have installed JDK 1.2.2 only, with other versions, not run
I use forms 6i.
/**
* Escribir un dato en el puerto COM15
* @autor Carlos_Lucio Abril 11 de 2013
*/
import java.io.IOException;
//import java.io.OutputStream;
import java.io.InputStream;
import javax.comm.CommPortIdentifier;
import javax.comm.SerialPort;
import javax.comm.PortInUseException;
import javax.comm.NoSuchPortException;
public class Bascula
{
public static String GetPeso() throws Exception
{
byte[] buffer = new byte[16];
String peso=null;
// OutputStream out = null;
InputStream in = null;
SerialPort com15;
// String mensaje = "$\r\n";
try
{
com15 = (SerialPort) CommPortIdentifier.getPortIdentifier("COM15").open( "Bascula Java", 500 );
com15.setSerialPortParams( 2400, SerialPort.DATABITS_7, SerialPort.STOPBITS_1, SerialPort.PARITY_EVEN );
// out = com15.getOutputStream();
in = com15.getInputStream();
do
{
// out.write( mensaje.getBytes() );
in.read(buffer);
// System.out.println( "Bandera"+in.available() );
peso = new String(buffer,0,16);
}while(!(((buffer[0]=='O'&&buffer[1]=='L')||(buffer[0]=='S'&&buffer[1]=='T')||(buffer[0]=='U'&&buffer[1]=='S'))&&(buffer[14]=='k'&&buffer[15]=='g')));
in.close();
com15.close();
}
catch( NoSuchPortException exc )
{
System.out.println( "El puerto COM15 no existe en el sistema... Error 01" );
peso = "E01";
}
catch( PortInUseException exc )
{
System.out.println( "El puerto COM15 esta en uso... Error 02" );
peso = "E02";
}
catch( IOException exc )
{
System.out.println( "Error de I/O... Error 03" );
peso ="E03";
}
return peso;
}
public static void main( String args[] )
{
String pesaje;
try
{
pesaje = GetPeso();
System.out.println( "Cadena de caracteres desde el puerto COM15: "+pesaje);
}
catch ( Exception e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Thank you for all
|
|
|
|
|
|
|
Re: Getting data in Forms from a weighing bridge through MSCOMM32.OCX [message #588783 is a reply to message #588777] |
Fri, 28 June 2013 06:33 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
anil_mishra.2010 wrote on Fri, 28 June 2013 11:36I request you to kindly tell me your mobile no to get support.
Do you really think anyone here is going to give out their phone number to a random stranger on the internet?
Not going to happen.
If you want someone at the end of the phone to offer support hire a contractor.
|
|
|
Re: Getting data in Forms from a weighing bridge through MSCOMM32.OCX [message #588847 is a reply to message #588783] |
Fri, 28 June 2013 17:51 |
|
CARLOSTHX
Messages: 5 Registered: March 2013 Location: Cancun
|
Junior Member |
|
|
Hi Anil! i can help you, but only if you are patient because i don't speak english very well, i'm from mexico . Well man, tell me your problem and let me analize it.
I resolved my problem using java code, the form that you attached for me was useless, note: only in my case.
So,first step download this:
1.- ECLIPSE 1.0 (IDE for java)
2.- Virtual Serial Ports Emulator (if the scale or weighbridge its away from your work of place) this program let to you simulate a COM1 serial port (virtual) for your tests.
3.- JDK 1.2.2 release 17
4.- Uninstall all JDKA, JRE, Java versions in your developer machine
Well man, first use the java code in previous messages, i uploaded my solution, for my particular case: one scale machine that get the weigh throuhg the RS232 cable, when the PC send '$' character ($ protocolo), some scales the information that you have to send to the PC -> wheigh machine may be the some string for example "C0", "F0" anyway, you have to read the technical user for to know your scale
When you can run the java program with the right information then make a jar file with the java classes and import it in your oracle forms 6i. Befero ensure that the environment variables are setting.
CLASSPATH:
;C:\orant\TOOLS\COMMON60\JAVA\IMPORTER.JAR;C:\Proyectos\JAVA\javax_comm\comm.jar;C:\Proyectos\JAVA\javax_comm\rt.jar;C:\Proyectos\JAV A\javax_comm\Bascula.jar;
PATH:
C:\orant\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files\Intel\DMIX;C:\Program Files\Intel\Services\IPT\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\orant\jdk\bin;C:\Program Files\JavaSoft\JRE\1.2\bin\classic;C:\jdk1.2.2\bin;
In many forums there are more information about this point, because my poor english i can't deep on it.
Now, go to Forms and import the java class (FILE.jar) was you created.
And automatically Forms make the Program Units in your Module.fmb.
I hope I have been helpful my comments
I can not give my mobile phone by being personal but if you give me your email I can add you to skype.
Saludos!!!
|
|
|
Re: Getting data in Forms from a weighing bridge through MSCOMM32.OCX [message #588850 is a reply to message #588847] |
Fri, 28 June 2013 20:19 |
|
anil_mishra.2010@yahoo.com
Messages: 3 Registered: June 2013 Location: India
|
Junior Member |
|
|
Respected Sir,
First I want to give you lot of thanks for immediate reply.
Now I have to ask you, that you have written that----
----------------------------------------------------------------------------------------------------------------------------
first step download this:
1.- ECLIPSE 1.0 (IDE for java)
2.- Virtual Serial Ports Emulator (if the scale or weighbridge its away from your work of place) this program let to you simulate a COM1 serial port (virtual) for your tests.
3.- JDK 1.2.2 release 17
4.- Uninstall all JDKA, JRE, Java versions in your developer machine
----------------------------------------------------------------------------------------------------
CLASSPATH:
;C:\orant\TOOLS\COMMON60\JAVA\IMPORTER.JAR;C:\Proyectos\JAVA\javax_comm\comm.jar;C:\Proyectos\JAVA\javax_comm\rt.jar;C:\Proyectos\JAV A\javax_comm\Bascula.jar;
PATH:
C:\orant\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files\Intel\DMIX;C:\Program Files\Intel\Services\IPT\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\orant\jdk\bin;C:\Program Files\JavaSoft\JRE\1.2\bin\classic;C:\jdk1.2.2\bin;
--------------------------------------------------------------------------------------------------------------------
Now, go to Forms and import the java class (FILE.jar) was you created.
And automatically Forms make the Program Units in your Module.fmb.
----------------------------------------------------------------------------------------------------------------
Respected Sir,
My question is that...
>>>In the first step after the downloading ECLIPSE 1.0 (IDE for java)
,Virtual Serial Ports Emulator (if the scale or weighbridge its away from your work of place) this program let to you simulate a COM1 serial port (virtual) for your tests.,JDK 1.2.2 release 17 & unistalation of all JDKA, JRE, Java versions from our developer machine what I have to do?
>>>Where & how I use the java code of previous messages? because I have no complete knowledge about java.
>>>>>>How to set the ..
CLASSPATH:
;C:\orant\TOOLS\COMMON60\JAVA\IMPORTER.JAR;C:\Proyectos\JAVA\javax_comm\comm.jar;C:\Proyectos\JAVA\javax_comm\rt.jar;C:\Proyectos\JAV A\javax_comm\Bascula.jar;
PATH:
C:\orant\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files\Intel\DMIX;C:\Program Files\Intel\Services\IPT\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\orant\jdk\bin;C:\Program Files\JavaSoft\JRE\1.2\bin\classic;C:\jdk1.2.2\bin;
How I create java class (FILE.jar) and import the java class (FILE.jar).
What & where code/sql have to write on the form 6i.
I am using windows 7,32bit & our system is of Dell company in which there is no any COM1 serial port.
My Email Id is : anil_mishra.2010@yahoo.com
How I contact to you?
Once again please mention all the step by step & if it is possible please send me your form with java class which you have designed for self.
I hope you will help me till the solution of my problem.
Thanking you,
With best regards,
Anil
|
|
|
|
Re: Getting data in Forms from a weighing bridge through MSCOMM32.OCX [message #611727 is a reply to message #607852] |
Tue, 08 April 2014 02:45 |
usmanajaz
Messages: 1 Registered: April 2014 Location: Karachi
|
Junior Member |
|
|
Dear All,
I am facing the similar issue when trying to capture the weight in oracle form 6i it show me the error (100503 : Non Oracle Expression) then i debug the form found that the function in PACKAGE BODY MSCOMMLib_IMSComm given the error. I have also test in real time.
FUNCTION PortOpen(interface OleObj) RETURN NUMBER IS
my_new_value NUMBER;
BEGIN
my_new_value := Get_Ole_Num(interface, 20); this is creating the problem...
return my_new_value;
End;
--Kindly explain the reason for this issue and also suggest the fix for that issue.
Thanks,
Usman
|
|
|
|
|
|