Question

Locked

How to reduce CPU utilization when it is using serial port communication?

By WAT ROBIN ·
don't tell me use sleep function,because i want the program run as soon as possible.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Exactly how depends on language, OS, and architecture

by Tony Hopkinson In reply to How to reduce CPU utiliza ...

but basically, you separate processing the data from the comms. The way your question is worded you are basically polling in a loop.
You need to write a process that gets kicked into life when something comes in on the port, caches the content, raises a gotsomedata event and then sleeps.
Then another process that listens for the got data event, processes it and then sleeps.

Look up asynchronous serial commincations for whatever environment you are on.

Back to Networks Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums