Reading From Weight Scale RS232 [message #673689] |
Mon, 03 December 2018 09:28 |
|
h.aly-it
Messages: 3 Registered: December 2018
|
Junior Member |
|
|
Dear All
I read All the Prev Post and tryed everything but nothing work please any one help me because iam involved in new Project to Read data From weight scale and dont know from where to start
Thank you
|
|
|
|
|
|
Re: Reading From Weight Scale RS232 [message #673694 is a reply to message #673692] |
Mon, 03 December 2018 23:19 |
|
h.aly-it
Messages: 3 Registered: December 2018
|
Junior Member |
|
|
Thank you All
I Tried with the Form wt.fmb and with the Program unit SCALEWEIGHT
--**********************************************************
--Purpose
--This piece of Code reads data from com port 1 and
--put the data in the given field. This task is being
--accomplished by using Microsoft Activ-X Control
--MSCOMM32.OCX as called as 'Communication Control'
--**********************************************************
FUNCTION ScaleWeight RETURN CHAR IS
receive OLEVAR;
v_buffer varchar2(10240);
x number;
Attempts Number:= 0; --counts the number of attempts to read the data from port
v_FirstPoint number; --used for taking the index of first symbol of 'kg'
v_SecondPoint number; --used for taking the index of second symbol of 'kg'
v_BufferLength number; --stores the data stream get from com port
v_DataStream varchar2(32767); -- gets the data from com port and stores in v_BufferLength
v_ScaleLoopCnt number:=0;
v_Number varchar2(200);
BEGIN
If (MSCOMMLib_IMSComm.PortOpen(:ITEM('BLOCK3.MSCOMMCONTROL').INTERFACE) = -1) then --open
null;
Else
MSCOMMLib_IMSComm.CommPort(:ITEM('BLOCK3.MSCOMMCONTROL').INTERFACE,3);
MSCOMMLib_IMSComm.Settings(:ITEM('BLOCK3.MSCOMMCONTROL').INTERFACE,'9600,N,8,1');
--MSCOMMLib_IMSComm.Settings(:ITEM('BLOCK3.MSCOMMCONTROL').INTERFACE,ConnStr);
MSCOMMLib_IMSComm.PortOpen(:ITEM('BLOCK3.MSCOMMCONTROL').INTERFACE,3);
End if;
--MSCOMMLib_IMSComm.PortOpen( comm_hnd, 1 );
--assigning the comport to active x control
--check to see whether it is already open or closed
v_FirstPoint := 0;
v_SecondPoint := 0;
v_buffer :=' ';
v_BufferLength := 0;
Attempts :=0;
loop
exit when (v_BufferLength > 150) or (Attempts > 200);
begin
mydelay(200);
receive := MSCOMMLib_IMSComm.input(:ITEM('BLOCK3.MSCOMMCONTROL').INTERFACE);
v_DataStream:= var_to_char(receive);
v_BufferLength := NVL(length(v_buffer||v_DataStream),0);
v_buffer := v_buffer||v_DataStream;
Attempts := Attempts +1;
exception when others then
-- Message(SQlcode||sqlerrm);
-- Message(SQlcode||sqlerrm);
null;
end;
end loop;
BREAK;
message(v_DataStream);
message(v_DataStream);
v_FirstPoint := nvl(instr(v_buffer,'kg',1),0);
v_SecondPoint := nvl(instr(v_buffer,'kg',v_FirstPoint+2),0);
v_buffer := substr(v_buffer,v_SecondPoint - 7 ,6);
if (instr(v_buffer,',',1) =0) then --no comma exists in the data
v_SecondPoint :=0;
end if;
--v_buffer := substr(v_buffer,1,2)||substr(v_buffer,4,3);
v_buffer := substr(v_buffer,1,7);--||substr(v_buffer,4,3);
v_number := to_number(v_buffer);
RETURN (v_number);
END;
It Run Without any Errors but Nothing Return
Thank you
--moderator edit: [code] tags added, please do this yourself in future
[Updated on: Tue, 04 December 2018 01:04] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: Reading From Weight Scale RS232 [message #676329 is a reply to message #673698] |
Sat, 01 June 2019 01:28 |
|
younush9
Messages: 1 Registered: June 2019
|
Junior Member |
|
|
Hi h.aly-it,
As i ahve gone through no of forums i came to know that MSCOMM32.OCX as called as 'Communication Control does not work in oracle Forms 9i & above , it works for only for forms 6i which is Obsolete now.
Im also struggling to Integrate Weight Scale with Oracle Forms 10g , If you were able to achieve results please share the Steps to Read Data from weight scale to Oracle Forms 10g.
Will Appreciate your Support.
REgards,
Younus
|
|
|