当前位置:天才代写 > ee代写 > MPLabX assembly代写 Guessing Game

MPLabX assembly代写 Guessing Game

2019-09-21 23:42 星期六 所属: ee代写 浏览:1544

MPLabX assembly代写 In this assignment, we will use MPLabX to develop and simulate an assembly language program for the PIC microcontroller that plays the guessing game

Guessing Game

Due: December 11, 2018

 

You need to upload your .asm file and a single pdf file containing your screenshots.

 

 

In order to get the extra credit, your code should be working properly.

In this assignment, we will use MPLabX to develop and simulate an assembly language program for the PIC microcontroller that plays the guessing game, as described in Section 7.7.1 of the Wakerly textbook, 4th ed. The assembly language program is to be tested using MPLab to apply the sequence of inputs given below.

This state machine has 4 inputs and 5 outputs. Students should use the PIC16F84A. The required pin assignments are given in the following table.

Required Pin Assignments

 

Inputs Right Outputs
Function PIC Function PIC
G1 RA0 L1 RB0
G2 RA1 L2 RB1
G3 RA2 L3 RB2
G4 RA3 L4 RB3
    ERR RB7

A high output is used to turn on a light while a low output signifies that the light is off.

Programs should initialize to state S1 and include a delay of ~1.0 second from one state to the next in the rotating light pattern. This delay could be created in different ways, for example, using a simple program loop, or using a timer with or without interrupts. It need not be precise, but should be accurate to ±0.05 seconds. You may choose your processor clock frequency to adjust the state delay.

The program should be tested using a stimulus workbook (“lab13.sbs”) that has been posted on Canvas with this assignment. This external stimulus is applied using

Stimulus à open a stimulus workbook (from icons to the left of the Stimulus window) being sure to “Apply” the stimulus.

Given the above timing, this stimulus makes a wrong guess, a correct guess, then simultaneous correct/wrong guess.

Your solution to this homework should include your documented assembly language code and watch window to demonstrate that your game responds properly to stimulus. This example shows a watch window following the first wrong guess. Your solution should show this watch winsow following each state change. This can be done most easily by setting breakpoints immediately following each state change in your code, then running the processor, which will automatically stop at each state change. You need to use a processor frequency of 100kHz.

MPLabX assembly代写
MPLabX assembly代写

Hints and Suggested Approach This general outline can be used. Main: ; start of the main program

; initialize the state machine

Mloop: ; beginning of one state machine cycle

; compute the next state

; compute new outputs

; delay for ~ 1.0 second – adjust for 1.0 second, state to state goto Mloop

 

Computation of the next state could potentially follow the approach used in the textbook which is geared for implementation using Verilog and logic hardware. There are other approaches, however, which are more sensible for a byte oriented, general purpose machine such as the PIC. For example, the state could be “one-hot encoded” to match the outputs, and the next-state could be computed using the table look-up or by if-then statements that consider the present state and the inputs.

 

Stimulus Window for HW 13, The Guessing Game:

 

Please use the .sbs file posted on Canvas by downloading and saving it under your project folder that you created for this homework. Once you open the Stimulus window, you can open the Stimulus file from there.

 

If you have trouble opening the provided Stimulus file, you can follow the steps provided below to generate your own stimulus file.

 

FOR MPLABX:

 

You need to open the Stimulus window from the menu item Window

FOR MPLAB VERSION USING CITRIX:

 

You can open a New Workbook from Debugger à Stimulus à New Workbook and type the following inputs for the Pin/Register Actions.

 

MPLabX assembly代写
MPLabX assembly代写

Do not forget to select ms as the Time Units.

 

最先出自天才代写 EE代写
合作:幽灵代写
 

天才代写-代写联系方式