Unformatted text preview:

Guy, Good – Homework 5 – Due: Mar 8 2004, 1:00 pm – Inst: Jon Valvano 1This print-out should have 15 questions.Multiple-choice questions may continue onthe next column or page – find all choicesbefore making your selection. The due time isCentral time.EE345L Valvano Homework 5.001 (part 1 of 1) 10 pointsA four-step output sequence repeated overand over will cause a stepper motor to spin.Which output sequence will rotate a step-per motor?1. None of these choices is correct.2. 1,2,4,8,1,2,4,8,...3. 0,1,2,3,0,1,2,3,...4. 1,2,3,4,1,2,3,4,...5. 9,10,6,5,9,10,6,5,...002 (part 1 of 1) 10 pointsAssume a stepper motor has 200 steps/rot,and the software outputs a new commandevery 21 ms/step.Assuming the motor has not stalled, whatis the rotational speed of this stepper? Giveyour answer in rpm.Answer in units of rpm.003 (part 1 of 3) 10 pointsThe following figure shows Moore finite statemachine. There are three states named S1 S2S3. There is one input signal, connected toPH0, which can be high or low. There is an8-bit output, connected to PORTJ.S121S237S345010101The following program is supposed to im-plement this Moore finite state machine.const struct State{xxx Out;const struct State *Next[2];};typedef const struct State StateType;#define S1 &FSM[0]#define S2 &FSM[1]#define S3 &FSM[2]StateType FSM[3]={{21,{S2,S3}},{37,{yyy}},{45,{S1,S2}}};void main(void){char Input;StatePtr Pt;DDRH = 0;DDRJ = 0xFF;Pt = S1;for(;;){PORTJ = Pt->Out;Input = PORTH&0x01;Pt = Pt->Next[Input];}}What C code should be placed in the xxxposition?1. None of these choices is correct.2. volatile.3. short.4. static.5. char.6. const.004 (part 2 of 3) 10 pointsWhat value should be placed in the yyy posi-tion?1. S1,S2.2. S1,S3.Guy, Good – Homework 5 – Due: Mar 8 2004, 1:00 pm – Inst: Jon Valvano 23. None of these choices is correct.4. S3,S1.5. S2,S3.6. 37.005 (part 3 of 3) 10 pointsAfter running for a while with a constantinput value of 1, what pattern of outputs willoccur?1. 21.2. 45.3. 45,37,21,45,37,21,....4. None of these choices is correct.5. 21,37,45,21,37,45,....6. 37.006 (part 1 of 4) 10 pointsThe following figure shows Mealy finite statemachine. There are three states named S1 S2S3. There is one input signal, connected toPJ0, which can be high or low. There is a16-bit time for each state, which contains thetime to wait in microseconds. There is a 1-bitoutput, connected to PH0.S120µsS250µsS310µs0/11/00/01/10/01/0The following program is supposed to im-plement this Mealy finite state machine. No-tice the sequence of actions performed by thiscontroller is 1)wait, 2) read input, 3) performoutput, and 4) go to next state. You may as-sume the Wait function delays for the num-ber of 125ns cycles as specified in the inputparameter.const struct State{xxx Time;char Out[2];const struct State *Next[2];};typedef const struct State StateType;#define S1 &FSM[0]#define S2 &FSM[1]#define S3 &FSM[2]StateType FSM[3]={{160,{1,0},{S2,S3}},{400,{yyy},{S3,S1}},{80, {0,0},{S1,S2}}};void main(void){char Input;StatePtr Pt;DDRH = DDRH|0x01;DDRJ = DDRJ&0xFE;Pt = S1;for(;;){Wait(Pt->Time);Input = PORTJ&0x01;zzzPt = Pt->Next[Input];}}What code should be placed in the xxxposition?1. static.2. char.3. long.4. short.5. volatile.007 (part 2 of 4) 10 pointsWhat value should be placed in the yyy posi-tion?1. S2,S3.2. S1,S2.Guy, Good -- Homework 5 -- Due: Mar 8 2004, 1:00 pm -- Inst: Jon Valvano 33. 0,1.4. 0,0.5. 1,0.008 (part 3 of 4) 10 pointsWhat code should be placed in the zzz posi-tion?1.PORTJ = Pt->Out;2.PORTH = Pt->Out[Input];3.PORTH = Input;4.PORTH = Out[Input];5.PORTH = Pt->Out;6.PORTH = PORTJ;009 (part 4 of 4) 10 pointsAfter running for a while with a constantinput value of 0, what pattern of outputs willoccur?1. A constant low.2. Can not be determined from this infor-mation.3. A constant high.4. A repeating pattern of an output high for50 us, followed by an output low for 30 us.5. A repeating pattern of an output high for20 us, followed by an output low for 60 us.010 (part 1 of 1) 10 pointsWhat is the difference between a Mealyfinite state machine and a Moore finite statemachine?1. The outputs of a Mealy finite state ma-chine depend just on the state, while the out-puts of a Moore finite state machine dependon both the state and the input.2. The outputs of a Moore finite state ma-chine depend just on the state, while the out-puts of a Mealy finite state machine dependon both the state and the input.3. The outputs of a Moore finite state ma-chine depend just on the state, while the out-puts of a Mealy finite state machine dependon just the the input.4. None of these choices is correct.5. A Moore finite state machine is moreefficient than a Mealy finite state machine.6. A Mealy finite state machine allows for atime delay in each state, while a Moore finitestate machine does not.011 (part 1 of 1) 10 pointsWhich address is the output compare 0 vec-tor?1. 0xFFF02. 0xFFEE3. 0xFFFE4. 0xFFE05. 0xFFFA6. none of the other answers is correct.012 (part 1 of 1) 10 pointsWhich interrupt number do you use whencompiling an output compare 7 ISR usingGuy, Good – Homework 5 – Due: Mar 8 2004, 1:00 pm – Inst: Jon Valvano 4Metrowerks? For example, what number goesinto the xx spot in the following C code?interrupt xx void handler(void){TC7 = TC7+20000;TFLG1 = 128;}013 (part 1 of 1) 10 pointsWhich software arms the output comparechannel 4 on the 812A4? For the 9S12C32,substitute TIE for TMSK1 and substituteTSCR1 for TSCR. If more than one soft-ware is possible, choose the friendly version.1.TSCR = 0x80;TIOS |= 0x10;TMSK1 &= 0xEF;2.TSCR = 0x80;TIOS = 0xFF;TMSK1 = 0xFF;3.TSCR = 0x80;TIOS |= 0x10;TMSK1 = 0x10;4.TSCR = 0x80;TIOS |= 0x10;TMSK1 |= 0x10;5.TSCR = 0x80;TIOS |= 0x10;TFLG1 |= 0x10;6.TSCR = 0x80;TIOS |= 0x10;TMSK1 = 0x00;014 (part 1 of 1) 10 pointsOn both the 812A4 and the 9S12C32, thetimer channel 7 flag, C7F, is bit 7 of theTFLG1 register. Assume the channel is con-figured as output compare. Which of thefollowing statements best describes the soft-ware action that will set the timer channel 7flag?1. The software reads the TCNT register.2. The software writes a 1 to the C7F bit.TFLG1 = 0x80;3. The software can not set C7F, but thisbit is set by the timer hardware when TC7matches TCNT.4. The software executes the swi instruc-tion.5. The software executes the rti instruc-tion.6. The software writes a 0 to the C7F bit.TFLG1 = 0x00;015 (part 1 of 1) 10 pointsOn both the 812A4 and the 9S12C32, thetimer channel 0 flag, C0F, is bit 0 of


View Full Document

UT EE 345 - Study Notes

Download Study Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?