Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Write a program which collects in data samples from a port at 1 ms interval. The upper 4 bits collected data same as mastered and stored in an array in successive locations.

; REGISTERS: Uses CS, SS, DS, AX, BX, CX, DX, SI, SP

; PROCEDURES: Uses WAIT

DATA_SEG       SEGMENT

            PRESSURE DW 100 DUP (0); Set up array of 100 words

NBR_OF_SAMPLES EQU 100    

            PRESSURE_PORT EQU 0FFF8h     ; hypothetical input port

DATA_SEG       ENDS

STACK_SEG SEGMENT STACK

            DW 40    DUP (0)    ; set stack of 40 words

STACK_TOP   LABEL WORD

STACK_SEG   ENDS

 

CODE_SEG SEGMENT

            ASSUME CS: CODE_SEG, DS: DATA_SEG, SS: STACK_SEG

START:           MOV   AX, DATA_SEG; Initialise data segment register

MOV DS, AX  

MOV AX, STACK_SEG   ; Initialise stack segment register

MOV SS, AX  

MOV SP, OFFSET STACK - TOP    ; initialise stack pointer top of 

                                                ; stack

LEA SI, PRESSURE; SI points to start of array 

     ; PRESSURE

MOV BX, NBR_OF_SAMPLES   ; Load BX with number

                        ; Of samples

MOV DX, PRESSURE_PORT   ; Point DX at input port

                                                ; It can be any A/D converter or 

                                                ; Data port.

READ_NEXT: IN AX, DX   ; Read data from port

            ; Please note use of IN instruction

            AND AX, 0FFFH; Mask upper 4 bits of AX

            MOV [SI], AX   ; Store data word in array

            CALL WAIT   ; call procedures wait for delay  

INC SI; Increment SI by two as dealing with 

INC SI; 16 bit words and not bytes

DEC BX; Decrement sample counter

JNZ READ_NEXT   ; Repeat till 100

      ; Samples are collected

STOP: NOP    

WAIT   PROC NEAR  

            MOV CX, 2000H   ; Load delay value

                                     ; Into CX

HERE:   LOOP HERE   ; Loop until CX = 0

            RET    

WAIT   ENDP    

CODE_SEG ENDS    

END    

Discussion:

Please consider that CALL to the procedure as above doesn't specify whether the call is to a FAR procedure or a NEAR procedure. This distinction is made at the time of defining the procedure. 

 

The procedure above can be converted in a FAR procedure by changing the definition of procedure as below:

WAIT              PROC FAR

 .

 .

WAIT             ENDS

The procedure can now be statedin another segment if the need to be, in same assembly language file.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9574772

Have any Question?


Related Questions in Computer Engineering

A 200g sample of acetylsalicylic acid better known

A 2.00g sample of acetylsalicylic acid, better known asaspirin, is dissolved in 100mL of water and titrated with 0.200mol/L NaOH(aq) to the end point. The volume of base required is 55.5mL. Calculate the molar mass of ac ...

Quesiton for completion of the program use arrays and

Quesiton: For completion of the program, use arrays and files. Instead of prompting the user for the prices of the book, update the website program to reflect the following changes: • Read the prices into an array from a ...

1 explain how the following industries should adapt

1. Explain how the following industries should adapt their businesses to the ever expanding use of social networks and mobile computing (smart phones, tablet computers, etc.): 1) Media and Entertainment, 2) Department st ...

Suppose we are given a directed graph g v e a set of nodes

Suppose we are given a directed graph G = (V, E), a set of nodes A V (denoted as people) and a set of nodes B V (denoted as exit). Assume A and B are disjoint. We want to find a schedule such that every person can escape ...

Why regulated industries should be required to follow

Why regulated industries should be required to follow security standards. Provide 2 examples of industries that would fall under this category.

Roberto is the network administrator for an international

Roberto is the network administrator for an international law firm with offices and customers in North America, South America, Africa, and the Middle East. The lawyers frequently contact each other via e-mail, use the In ...

The following few machines are given informal

The following few machines are given informal descriptions. Decide whether they are of CISC or of RISC design, and provide a short description of why. a) Machine A has over 300 instructions, many of which are executed at ...

What service is defined as it services for example in a gym

What service is defined as IT services? For example, in a gym, is members called IT services? What else? could you give me another example?

Question a show the results of inserting 10 12 1 14 6 5 8

Question : a) Show the results of inserting 10, 12, 1, 14, 6, 5, 8, 15, 3, 9, 7, 4, 11, 13, and 2, one at a into an initially empty binary heap. Show the tree at each stage. b) Show the result of performing three DeleteM ...

Need help with a java program that takes two arrays a and b

Need help with a Java program that takes two arrays a and b of length 5 storing int values, and returns the dot product of a and b. That is, it returns an array c of length n such that c[i]=a[i]*b[i].

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As