Hey guys!
I wonder if anyone has accessed the serial port (COM1) ???
I actually have an equipment connected to COM1 and I want to get port data! ???
Access to serial port
- dr_gori
- Moderador
- Posts: 5026
- Joined: Mon, 03 May 2004 3:08 pm
- Location: Portland, OR USA
- Contact:
Thomas F. G
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
In Forms, I'vê seen situations like this several times.
In fact, Forms does not connect to the serial. Whoever does this is a DLL (in C, Delphi, etc.) and Forms connects on it through Ora_FFI. (which is an interface between DLL and Forms)
in the bank, I have never seen, but I believe it is the same way:
* A program is listening to the door with And send the information to Oracle read. (perhaps until text is possible)
: Cry:
In fact, Forms does not connect to the serial. Whoever does this is a DLL (in C, Delphi, etc.) and Forms connects on it through Ora_FFI. (which is an interface between DLL and Forms)
in the bank, I have never seen, but I believe it is the same way:
* A program is listening to the door with And send the information to Oracle read. (perhaps until text is possible)
: Cry:
-
- Rank: DBA Pleno
- Posts: 232
- Joined: Fri, 30 Mar 2007 7:26 pm
- Location: Londrina - PR
Rafael O. Genaro
Hey guys!
Taking advantage of the topic, I have a problem to perform the data transmission via serial port (for now, I am using the MSCOMM.OCX component, importing the OLE interfaces for the Forms - Menu Program> IMPORT OLE LIBRARY INTERFACES. If anyone has another suggestion, I accept anything: P).
This is the situation:
I need to send information (binary data) to a certain serial port.
I was able to make everything work almost perfectly, using the Output method of the MScomm.ocx library, with only one problem:
when I try to send the byte 0x00 / CHR (0), It is ignored by the library (by sending the byte data to byte). If I try to send the data to a single string, all bytes from the 0x00 character are ignored.
I have been inviting, and apparently the reason is that Strings in Visual Basic (language in which the component has been done) are finalized with this character.
Is anyone ever encountered this problem? Or would you have any alternative?
Below is my procedure:
Thanks!
Taking advantage of the topic, I have a problem to perform the data transmission via serial port (for now, I am using the MSCOMM.OCX component, importing the OLE interfaces for the Forms - Menu Program> IMPORT OLE LIBRARY INTERFACES. If anyone has another suggestion, I accept anything: P).
This is the situation:
I need to send information (binary data) to a certain serial port.
I was able to make everything work almost perfectly, using the Output method of the MScomm.ocx library, with only one problem:
when I try to send the byte 0x00 / CHR (0), It is ignored by the library (by sending the byte data to byte). If I try to send the data to a single string, all bytes from the 0x00 character are ignored.
I have been inviting, and apparently the reason is that Strings in Visual Basic (language in which the component has been done) are finalized with this character.
Is anyone ever encountered this problem? Or would you have any alternative?
Below is my procedure:
procedure p_envida_dados
( p_porta in number
) is
comm_hnd ole2.obj_type;
begin
synchronize;
comm_hnd := ole2.create_obj('MSCOMMLib.MSComm');
MSCOMMLib_IMSComm.CommPort( comm_hnd, p_porta ); -- Define a porta serial
MSCOMMLib_IMSComm.Settings( comm_hnd, '9600,N,8,2' ); -- Define as propriedades de conexão
MSCOMMLib_IMSComm.PortOpen( comm_hnd, 1 ); -- Abre a porta
ret := MSCOMMLib_IMSComm.PortOpen( comm_hnd ); -- Verifica se a porta foi aberta
if ret = 0 then
msg('Erro ao abrir a conexão!', 'I', true);
end if;
-- Define demais parâmetros da conexão
MSCOMMLib_IMSComm.InputMode ( comm_hnd, MSCOMMLib_Constants.comInputModeBinary );
MSCOMMLib_IMSComm.NullDiscard( comm_hnd, 1 );
MSCOMMLib_IMSComm.InputLen ( comm_hnd, 0 );
MSCOMMLib_IMSComm.EOFEnable ( comm_hnd, 26 );
MSCOMMLib_IMSComm.DTREnable ( comm_hnd, 0 );
MSCOMMLib_IMSComm.RTSEnable ( comm_hnd, 0 );
--
dbms_lock.sleep(seconds => .5);
MSCOMMLib_IMSComm.InBufferCount( comm_hnd, 0 ); -- Limpa o buffer de entrada
-- teste 01 - Enviando uma única string -- InputLen = 0
-- Neste caso, só o byte "02" é enviado até o hardware
MSCOMMLib_IMSComm.Output( comm_hnd, to_variant(utl_raw.cast_to_varchar2('020005FF')));
MSCOMMLib_IMSComm.InBufferCount( comm_hnd, 0 ); -- Limpa o buffer de entrada
--
-- teste 02 - Enviando a string byte a byte -- InputLen = 1
-- Neste caso, chegam até o hardware os caracteres "0205FF" - O caracter 00 é ignorado
MSCOMMLib_IMSComm.Output( comm_hnd, to_variant(utl_raw.cast_to_varchar2('02')));
dbms_lock.sleep(seconds => .1);
MSCOMMLib_IMSComm.Output( comm_hnd, to_variant(utl_raw.cast_to_varchar2('00')));
dbms_lock.sleep(seconds => .1);
MSCOMMLib_IMSComm.Output( comm_hnd, to_variant(utl_raw.cast_to_varchar2('05')));
dbms_lock.sleep(seconds => .1);
MSCOMMLib_IMSComm.Output( comm_hnd, to_variant(utl_raw.cast_to_varchar2('FF')));
dbms_lock.sleep(seconds => .1);
MSCOMMLib_IMSComm.InBufferCount( comm_hnd, 0 ); -- Limpa o buffer de entrada
--
-- teste 03 - chamando a função Set_Ole forçando o byte a ser tratado
-- como numérico -- InputLen = 1
-- Neste caso, o forms dispara o erro 0x80020005 - Type mismatch
MSCOMMLib_IMSComm.Output( comm_hnd, to_variant(utl_raw.cast_to_varchar2('02')));
dbms_lock.sleep(seconds => .1);
-- tratmento especial para o byte 00
Init_OleArgs(1);
Set_Ole(comm_hnd, 25, 0, VT_R8);
--
dbms_lock.sleep(seconds => .1);
MSCOMMLib_IMSComm.Output( comm_hnd, to_variant(utl_raw.cast_to_varchar2('05')));
dbms_lock.sleep(seconds => .1);
MSCOMMLib_IMSComm.Output( comm_hnd, to_variant(utl_raw.cast_to_varchar2('FF')));
dbms_lock.sleep(seconds => .1);
MSCOMMLib_IMSComm.InBufferCount( comm_hnd, 0 ); -- Limpa o buffer de entrada
--
MSCOMMLib_IMSComm.PortOpen( comm_hnd, 0); -- Fecha a porta
ole2.release_obj( comm_hnd ); -- Libera o objeto OLE
end;
Just a suggestion, you can use Java to read and treat the data returned by the serial. Java is well perfomatic for such a task, if you want to know more about serial communication in Java is only access here: http://www.viamais.net/blog/?cat=6
After the application ready and compiled in jar gives you Integrate to your Forms.
After the application ready and compiled in jar gives you Integrate to your Forms.
I have a problem I think you can help me, I created a java classer who communicates with the serial port com6, I am using the commerious door to communicate with the door, the problem is that I need to move to Oracle a DLL do that? Thanks.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 1 guest