
Karim A.
asked 01/17/21Assignment of Microprocessor Fundamentals
In a pressure-monitoring environment, 10 pressure sensors have been connected. The pressure from these sensors has to be read at intervals of 5 msec. Write an assembly program to read the sensor values from input ports having address 0FF0H to 0FF9H
1 Expert Answer

Aaron T. answered 01/17/21
Bachelors in Computer Science with 8+ Years of Industry Experience
Hi Karim, based on the question I'm unclear on two points: first, whether the environment supports a timed pause, and second, where the values read from the sensors should be stored. However, the basic operations the program needs to perform are:
- [program prologue if needed: language/environment specific]
- Set a label
- move contents of memory address 0FF0H into register eax
- move contents of register eax into some memory address to be read by another program
- [Repeat for remaining 9 sensor input addresses]
- Pause/sleep for 5ms
- Go to label
- [program epilogue if needed: language/environment specific]
For step 6, this might be done using an interrupt like WAIT (15h with 86h), or an instruction with a timed delay (like the very recent Intel TPAUSE) if supported by the environment.
I can see at least one major decisions to make in terms of the program implementation. You can decide to program the move instructions explicitly for each pressure sensor, which would be computationally efficient (by avoiding comparisons operations) as well as the simplest to program/understand. However, since this is a microprocessor, memory space may be limited. Thus, you could also choose to use additional registers to implement a for loop to loop over all 10 sensors, which would limit the memory footprint of the function.
Hope this helps! Feel free to comment here with more information or questions.
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Aaron T.
Hi Karim, is there a specific assembly language you're working in (e.g. x86, IA-32, other)? In addition to general syntax differences, stack setup, and function return value placement, the instruction used to pause/halt/sleep/wait for 5ms will be dependent on the language/environment.01/17/21