-->
Page 1 of 3

Synchronous or asynchronous

PostPosted: Sat Jan 29, 2022 2:29 pm
by Hairyloon
I'm a bit confused about asynchronous operation, and how it fits around whatever else the chip might be doing.
I think I have a bunch of questions, but I'm struggling to formulate them for asking, except for the one about timing: does it do something frightully clever, or does asynchronous operation mean that we cannot know how long it might take to do any given thing?

Re: Synchronous or asynchronous

PostPosted: Sun Jan 30, 2022 6:01 am
by rpiloverbd

Re: Synchronous or asynchronous

PostPosted: Sun Jan 30, 2022 11:52 am
by btidey
I suspect the question was about asynchronous / synchronous operation of software elements rather than serial communication.

If so then then the following ideas should help get you going.

The basic difference is that in synchronous operation an action to do something is performed in one continuous step whereas in asynchronous operation a request is made to perform an action and control is immediately returned. Some time later when the action has been performed then the results are communicated back as a separate step.

Synchronous operation has the advantage of simplicity and is fine when the operation can be performed quickly. Asynchronous operation is more complex both for the requestor and action taker but is much more flexible, allowing other work to continue and is particularly good when the operation may take some time to complete.

The Webserver on the ESP8266 is a good example where there are both synchronous and asynchronous versions. In the simple standard built in synchronous case a request like a GET is performed synchronously and the result must be generated and fed back to the client all in one step. The ESO8266 cannot do anything else in the meantime. For the asynchronous case the GET initiates an action to generate the result and when that becomes available then the http response is generated and sent back. So for example if the request generated a request to read a temperature and that took seconds then no other useful work could be done while this was being done in a synchronous system. Another advantage of the asynchronous approach is that it becomes possible to accept multiple requests without waiting for each to complete.

Synchronous and asynchronous methods can be applied to virtually any activity with the choice being made between simplicity and efficiency.

See https://www.bmc.com/blogs/asynchronous-programming/ for a general introduction

Re: Synchronous or asynchronous

PostPosted: Tue Feb 08, 2022 5:11 pm
by sipan1313
hello

ps: I2C is a synchronous, multi-controller/multi-target, packet-switched, single-ended, serial communication. It is used to connect external sensor products and display screens, etc.

ESP8266EX has one I2C, which is realized via software programming, used to connect with other microcontrollers and other peripheral equipment such as sensors.