Project INEL 4206 Fall 2018
Project Description Ultimate objective: build an arithmetic operations server that receives an ASCII string (through a serial port) that describes the desired operations. The server performs the math calculations and return the result in another string. Project: put together an early prototype of this server an MSP430 micro-controller using assembly language. • Because receiving the string through a serial port is beyond the scope of the course, it will be stored in RAM. • Your program will identify the operations and perform the calculation. • The string will contain two operands and an operation, can be: +, -, * or /.
Example of strings +500, +200, + +123, +121, * -123, 121, * -1523, -231, + -1523, -231, - -234, +23, /
Tasks • Extract the operands. • Convert the numbers into binary, taking note of the number’s sign. • Identify the operation • Perform the operation • Convert the numbers from binary to ASCII • Save the result into a second string
Requirements • Assume that the result will fit into a 16-bit register. • Only the integer part of the division is required. 1. Work in teams of up to 3 students 2. Must use assembly language 3. Demonstrate working prototype 4. Submit well written project Report. 5. Code should be implemented e ffi ciently, using a reasonable number of instructions for each task. 6. Deadline for submission: November 15, 2018.
Report A preliminary report outline follows. New sections may be added to satisfy ABET requirements. 1. Title page 2. Project description: describe the problem in your own words 3. Program description: describe your program in detail using text, flow-charts, pseudo-code 4. Tests and results 5. List of references 6. Appendix: source code
Grading Activity Weight Demonstration 50% Report 25% Overall Quality 25%
Example: Replace character #include "msp430.h" ; #define controlled include file NAME main ; module name PUBLIC main ; make the main label vissible ; outside this module ORG 0FFFEh DC16 init ; set reset vector to 'init' label ORG 0200h mystr DB "This is a test" oldch DB 'i' newch DB 'I' � 9
RSEG CSTACK ; pre-declaration of segment RSEG CODE ; place program in 'CODE' segment init: MOV #SFE(CSTACK), SP ; set up stack main: NOP ; main program MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer mov #mystr, R12 mov.b oldch, R13 mov.b newch, R14 call #chrep JMP $ ; jump to current location '$' NOP � 10
; On string pointed by R12, replace character in R13 with ; that on R14 chrep: mov R12, R15 ; R12 = number of instances found mov #0, R12 ; initialize again: cmp.b #0, 0(R15) jeq done cmp.b @R15,R13 jeq rep jmp nextch rep: mov.b R14, 0(R15) inc r12 nextch: inc R15 jmp again done: ret � 11
Recommend
More recommend