time-critical task

jpanhalt

Joined Jan 18, 2008
11,087
In what context do you mean it?

Landing a jet on a carrier?
Submitting a final exam?
Paying alimony?

Most important what in the link you posted do you find confusing?
 

Papabravo

Joined Feb 24, 2006
21,159
Last edited:
Like nsaspook said, the timer. You would not wan;t an interrupt randomly like every 0.5s, 1s, 2s if you need it at least 1/s. Your timing could be 1 interrupt ever 1s +-10mS.

If your doing PID, then the critical timing would be different.

if your positioning heads in a hard drive to read a sector it's also different.

With the old MacOS, the program running handed over control to the OS. Time sharing can be pre-emptive multi-tasking which is usually a round-robin allowcating time to run. If you were trying to dim a light bulb at the same time, the OS would not allow that to happen because you could not fire the triac in the right place.

I learned it as "A guaranteed response to a given event"

Usually, the interrupt handler disables interrupts, sets the fact that an interrupt occured. You don;t want an interrupt occuring during an interrupt. Then it enables interrupts again.

if you were timing something, the ISR would have to save the system timer value.

In windows, I was trying to move a 60 Hz synchonous motor using Labview. I could not. Hardware had to do the motor move.
Software could do the how often (max 1-2 minutes). it could compute how long to move (fractions of a second to 10's of seconds), but could not complete the move properly.
 

Thread Starter

microcontroller60

Joined Oct 1, 2019
62
In what context do you mean it?
I am asking in the context of embedded system. For example, cars are going at high speed on the highway and we have to count how many cars are passing on high way. we need a system that should be able to count number of cars.
It is very difficult to count the number of car's running on highway by the embedded system because the react time is very less. does this a critical time to for embedded system?
 

jpanhalt

Joined Jan 18, 2008
11,087
A little strange question, but do you know about any such critical task which is completed on 10ms in embedded system ?
Do you really mean 10 ms, really? At 32 MHz in a PIC, that is 125 ns per instruction or 8000 instructions per ms. I will leave the calculation of instructions per 10 ms to the reader.
 

Thread Starter

microcontroller60

Joined Oct 1, 2019
62
Do you really mean 10 ms, really? At 32 MHz in a PIC, that is 125 ns per instruction or 8000 instructions per ms. I will leave the calculation of instructions per 10 ms to the reader.
Let's assume we are sending data from PIC 32 MHz to LCD. Response time of LCD is 100 ms. LCD takes a long time. Is there any device that has very short response time ?

Is there any device in cooking timer that responds in very short time ?
Is there any device in temperature of a glass furnace system that responds in very short time ?
 

jpanhalt

Joined Jan 18, 2008
11,087
When I clear DDRAM on the graphical LCD I am currently using, writing to every byte on the 132x64 screen takes 19607 Tcy, which at 32 MHz and SPI at Fosc/4 takes 2.451 ms. The 4x20 LCD I was using before operated easily at over 100K baud, which is less than 10 ms to write every character.

I used both displays with the MAX31856 digital thermocouple amplifier. That device can operate in different modes. In the 1-shot mode, a single conversion with a 60 Hz filter requires 143 ms. In continuous read mode, each reading is 82 ms. Since I only read every 2 or 3 seconds, I have not found any display or calculations limiting. Now, if you are reading every 100 ms, display and calculation delays might matter.

Is there any device in cooking timer that responds in very short time ?
What's a "very short time?" When I am baking, 10 seconds is a "very short time." A few seconds would be a very short time when glass blowing by hand. I have no experience with a glass furnace.
 
A little strange question, but do you know about any such critical task which is completed on 10ms in embedded system ?
Assuming you were generating an interrupt at 60 Hz from the AC line for time keeping, you need to service that interrupt every 16.6s or your timing could be off. The actual number depends on the time resolution you need.

In a task time-sharing real-time application, you might have a time keeping function and functions to handle wait(mS). Each process gets to run for a certain amount of time in a round-robin. Here https://www.geeksforgeeks.org/program-round-robin-scheduling-set-1/ is a whole bunch of scheduling algorithms discussed.

I remember an OS which had a "null job". When there is nothing to do, it rotated the lights on the CPU front panel.

I remember writing a program to "pretty print" a BASIC program where the CPU time and the elapsed time were virtually identical. I wrote it two ways and the first way was really really slow. The second algorithm I developed was almost like compiler writing where it could generate tokens really really fast. Spaces didn't matter in this BASIC. The BASIC had a command that changed string into an array of ASCII characters.

In the first pass, it identified quoted strings and line numbers. I did not handle/reduce print "a";"b" or "a"+"b" constructs. e.g. pretty print to print "ab". Token scanning was done in a a particular order and certain tokens like "for input as file" was a single token.
i then, with an input of "10 Input "Value of n";n : Start = 3" ended up an array of say:
n n s s s s s s s s s s s c 0 0 0 0 0 e 0 (pretend these are numbers)
n - line number token
s - string
c = colon
0 = not a token
e = equals

I would look at that array and insert a space when the numbers changed.
Spaces before and after the colon.
Spaces before and after the equal sign may have been an option.
Spaces were removed by the pre-processor.
Certain tokens like "forinputasfile" would have a replacement of say "for input as file"

If I took it further, I could have the basis of a compiler.

In this BASIC lines could be extended with a line feed.
 
Last edited:
Top