Homework 6 due Nov 5

Write program for the 8051 that takes 3 rapid measurements with the sonar every time an 'M' is received on the 8051's serial port. Each measurement along with the average should be sent out over the serial port. For every data item sent, an acknowledgement 'A' must be received before the next data item can be sent. If an 'M' is received instead of an expected acknowledgement then the system is reset and new measurements are taken.

qThe sonar works this way:

when INIT is asserted an audio pulse is emitted. When the echo is received the sonar device asserts ECHO. ECHO is held asserted by the sonar device until the INIT input is cleared. 

From specs above , define the following tasks:

Øsonar_top()  // interrupt routine when echo goes hi
Øserial_top()  // interrupt serial byte transfer completed (send or recv)
serial_bot()    // task for processing incoming commands and acknowledgement  and for sending measurement data. Transmissions should begin as soon as data is available. Don't wait until all three readings are completed.  
qsonar_bot() // task for processing sonar readings. This task should not have to wait for previous serial transmission to complete before  initiating another reading. The acknowledgements might be delayed for a long time but the readings should all as close together as possible. 
qTurn in C code using RTX Tiny tasks and systems calls. You can write psuedo code for hardware setup, such as timers, etc.

qWhat are the hard deadlines in your system? what are the soft deadlines? Are there any schedulability concerns?