Response time of a Task

Thread Starter

mukesh1

Joined Mar 22, 2020
45
Microcontroller is very faster than input/output devices.

Taking a hypothetical situation where PIC running with 20Mhz performing below Tasks

  1. PIC sending Data to LCD
  2. PIC controlling Relay
  3. PIC reading sensor

Response Time of LCD is 100ms
Response Time of relay is 10ms
Response Time of sensor is 5ms

PIC is preforming three tasks. What would be time from activation until completion for each tasks.

Just remember that thought came to my mind and I asked question.
 

trebla

Joined Jun 29, 2019
360
Response Time of relay is 10ms
Unless the PIC verifies the relay is turned on in some way, turning on the relay takes one instruction cycle.
If you use blocking routines for sensor reading and LCD writing the whole cycle takes approximately a sum of all performed tasks durations.
 

BobTPH

Joined Jun 5, 2013
3,316
handling those three tasks, the micro would most likely be idle 99% of the time.

But it depends on what kind if computation is needed.

Bob
 
Last edited:

BobaMosfet

Joined Jul 1, 2009
1,776
Microcontroller is very faster than input/output devices.

Taking a hypothetical situation where PIC running with 20Mhz performing below Tasks

  1. PIC sending Data to LCD
  2. PIC controlling Relay
  3. PIC reading sensor

Response Time of LCD is 100ms
Response Time of relay is 10ms
Response Time of sensor is 5ms

PIC is preforming three tasks. What would be time from activation until completion for each tasks.

Just remember that thought came to my mind and I asked question.
This is where you need read datasheets, experiment, and learn- like how we did it.

Sending data to LCD has commands that take time, as defined in the datasheet. LCD Response time is much faster than 100ms, normally. More like 1 to 10ms, depending on command. Relay, depends on type of relay. Sensor, depends on type of sensor.
 

KeithWalker

Joined Jul 10, 2017
1,789
To put the answers above in a nutshell:
The processor will be busy during the whole time it is communicating with and sending data to the display.
Once the bit is set to actuate the relay, the processor does not need to wait wait for the relay to actuate.
The time it takes to receive an input depends on what the input is. It could be just checking the status of an input , waiting for an input, with timeout or reading a long data string.
 

nsaspook

Joined Aug 27, 2009
8,389
This is where a bit of advanced controller hardware becomes very useful in improving the task response external to events. With the proper use of DMA and priority interrupts all three tasks (the LCD is the biggest bang for buck task to offload) can be handled with little or no main thread of execution intervention.
 
Top