Re: Reduce CPU time while using serialport?



On Sep 8, 9:11 am, Brian McCauley <nobul...@xxxxxxxxx> wrote:
On 6 Sep, 21:18, jis <jisma...@xxxxxxxxx> wrote:

I am using Win32::serialport for reading a data through a scanner
which is connected to the serial port.
I use polling as below.But this consumes 99% of my CPU time. and
slows down the system.
while(!($data=~/\r/))
{
$data=$Scanner->input(); #read the scanner port
$labeldata=$labeldata.$data; #append
}

Is there any way I implement interrupts or events using perl. Or is
there any other method to solve this issue.

Is there any particular reason you couldn't simply use a blocking read
rather than a non-blocking one?

I am now trying to use $Scanner->lookfor which is a blocking read i
believe. But main issue now is I am using a perl tk window in the
program. The tk window needs continuous update.The call lookfor takes
me to unknownloop and prevents me from servicing tk window.

Appreciate your help.

Cheers,
jis

.



Relevant Pages

  • Re: XP (Window MCE 2004) very very slow!
    ... Slow even in Safe Mode, I would unplug all your external type ... the Taskmgr window. ... Try to match the CPU Time with I/O Writes and note the process ... > The same applies even booting into safe mode! ...
    (microsoft.public.windowsxp.general)
  • Re: 8400 - Choppy Sound, Erratic Mouse
    ... >> drives, ... >> the right window shows about 35-50% busy at the same time. ... > Why not try using Task Manager and customize the "Processes display to ... > left click on CPU Time twice to sort it into ...
    (alt.sys.pc-clone.dell)
  • Re: Problems with TextFile parsing
    ... just moving the window should just queue up a few messages and that's ... Now it slows down if I do anything. ... procedure Split(S, Delimiter: string; Strings:TStrings); ... Strings.Add(Copy(S, OldP, Length(S))); ...
    (borland.public.delphi.language.objectpascal)
  • RE: 100% cpu explorer.exe
    ... (Links to online virus scans on the same page) ... it then tells me the window is not responding and has to ... > taking up 100% cpu time, and the only thing to do is to restart my computer. ... > the like using Norton, Adaware and Spybot, plus I've defragmented twice, once ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Media Center lagging
    ... Is this just when you're clicking outside the window (i.e., ... clicking on the CPU column header to sort by that column. ... When the Media ... > slows down. ...
    (microsoft.public.windows.mediacenter)