• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

open/close 2+ comm ports on run time with delphi 7 on win xp

Started by poulios, January 27, 2010, 07:14:53 pm

Previous topic - Next topic

poulios

hello everyone and Thank you for your help in advance.

i am using nrComm_Lib_7.11 and at the startup of my application i create 2+ comm ports, and the same number of memos
to use as a terminal for every port.
after that i am activating them all with a for loop.
i also use a timer that counts 1 minute, after that minute i am closing all ports with a for loop as before.
then i am collecting-using the recieved data from my memos, and after several procedures i activate all my ports again
for 1 minute.

i am doing all this because i want to collect data from wireless heating usb sensors every minute all the time.

the problem is that some times after 3-4 hours i maybe get one of the following errors:

1)
myapplication.exe-Application Error
the instruction at "0X00000000" referenced memory at "0x00000000". the memory could not be "read"
click ok to terminate the programm...

2)
myapplication.exe
myapplication.exe has encountered a problem and needs to close. we are sorry for the inconvenience...


is it the way i am using nrcommlib?

i use the activate property for open/close connection and the following code for the runtime creation

                      for i:=1 to DataModule1.ADOQuery1.Recordset.RecordCount do
                      begin                           
                            if TnrComm(FindComponent('comm'+inttostr(i))) = nil then
                            begin
                              //dimiourgo ta comms
                                  MyComms := TnrComm.Create(frmMain);
                                  MyComms.Name := 'comm';
                                  MyComms.Name := MyComms.Name + inttostr(i);
                                  MyComPortNo := vartostr(DataModule1.ADOQuery1.FieldValues['Port']);
                                  MyComms.ComPortNo := strtoint(MyComPortNo);
                                  MyComms.BaudRate := 9600;
                                  MyComms.ByteSize := 8;
                                  MyComms.Parity := pNone;
                                  MyComms.StopBits := sbOne;
                                  MyComms.StreamProtocol := spNone;
                                  MyComms.Active := False;
                                  MyComms.Terminal := MyMemos;
                                  MyComms.TerminalUsage :=tuReceive;
                              end;//if
                     end;//for

and the following proc to activate them

procedure TotalnrCommActivation(sender: TObject);
var
i:integer;
begin
    With frmMain do
    begin
         for i:=1 to strtoint(MyMasterNum) do
         begin
              TnrComm(FindComponent('comm'+ inttostr(i))).Active:=true;
         end;//for
    end;//with
end;

please help!!!

Roman Novgorodov

Hello

Please try latest version of nrComm Lib v9.01

The 7.11 version is three-four years old and it can not be tested with Win7 :-)

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.