Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Produce multiple state machine implementation to output a text string to the UART when button A0 is turned on. The string should be output on
Produce multiple state machine implementation to output a text string to the UART when button A0 is turned on. The string should be output on the rising edge of A0. That way only one string is output when turned on. A Button Manager state machine monitors and defines the transition when A0 is turned on. A global variable is used as a control flag to begin the output process. Create a char * pstr pointer and set it to NULL when initializing the program. When A0 is turned on, then set pstr to point to the string to be output on the UART See the following block diagram of the assignment: Baneperunuer HUART Button Queue Manager Manager SM SM C Functions SM Hardware These are the required elements for implementation The Queue Manager state machine will have a Wait state to monitor pstr. Create a Qmgr state so when pst!=NULL, then the string will transfer to the Queue at processor speed. Use a while loop to move characters at processor speed if the Queue is not full, . If the Queue goes full, then go back and wait in the Qmgr state for the Queue to accept more characters. Once the whole string has been placed in the Queue, then set pstr-NULL to end the process and wait for the next string to output. Remember that a string has an End Of String (EOS) character at the end which is "0' a binary zero which becomes one of the while loop end conditions. Another end condition is if the Queue becomes full. A third end condition is a safety one which can monitor if more that a reasonable amount of characters is transferred (like 128) to prevent a runaway condition if pstr has some type of error The UART manager will remove a character from the Queue and output it to the UART whenever TxReady signals the UART can accept a character and the Queue is not empty. Queue empty status will place the UART manager back into a wait state There is an error in the solution code provided: - see the class web page. Solution with problems After a string has been output, a Queue Underflow error message is created. Identify and correct the problem in the UARTMgr. The solution is that the exit transition in the UARTMgr state machine should be unconditional, not depending on the value of TxReady. So set the exit condition to a constant that is always true Turn in the RIBS diagrams of the corrected state machines and the listing of the C code for the assignment. Produce multiple state machine implementation to output a text string to the UART when button A0 is turned on. The string should be output on the rising edge of A0. That way only one string is output when turned on. A Button Manager state machine monitors and defines the transition when A0 is turned on. A global variable is used as a control flag to begin the output process. Create a char * pstr pointer and set it to NULL when initializing the program. When A0 is turned on, then set pstr to point to the string to be output on the UART See the following block diagram of the assignment: Baneperunuer HUART Button Queue Manager Manager SM SM C Functions SM Hardware These are the required elements for implementation The Queue Manager state machine will have a Wait state to monitor pstr. Create a Qmgr state so when pst!=NULL, then the string will transfer to the Queue at processor speed. Use a while loop to move characters at processor speed if the Queue is not full, . If the Queue goes full, then go back and wait in the Qmgr state for the Queue to accept more characters. Once the whole string has been placed in the Queue, then set pstr-NULL to end the process and wait for the next string to output. Remember that a string has an End Of String (EOS) character at the end which is "0' a binary zero which becomes one of the while loop end conditions. Another end condition is if the Queue becomes full. A third end condition is a safety one which can monitor if more that a reasonable amount of characters is transferred (like 128) to prevent a runaway condition if pstr has some type of error The UART manager will remove a character from the Queue and output it to the UART whenever TxReady signals the UART can accept a character and the Queue is not empty. Queue empty status will place the UART manager back into a wait state There is an error in the solution code provided: - see the class web page. Solution with problems After a string has been output, a Queue Underflow error message is created. Identify and correct the problem in the UARTMgr. The solution is that the exit transition in the UARTMgr state machine should be unconditional, not depending on the value of TxReady. So set the exit condition to a constant that is always true Turn in the RIBS diagrams of the corrected state machines and the listing of the C code for the assignment
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started