In: Computer Science
Write an assembly language program which will capture 250 data samples from the ADC0804 converter and store this data in external RAM starting at 2000H. Identify your selected port pins to the converter. The program must be an interrupt driven
The assembly language program is given as follows:
ORG 2000h ; define memory start address 2000h
LJMP MAIN ; jump to MAIN program
ORG 2000h ; define vector location for INT0
LJMP ISR0 ; jump to ISR0
MAIN:
MOV P1, #0FFh ; initialise Port 1 for use as input
MOV DPTR, #2000h ; set up memory pointer
MOV R6 , #250d ; use R6 to count
SETB IT0 ; define negative edge trigger for int 0
MOV IE, #10000001b ; enable Interrupt 0
LOOP: LJMP LOOP ; just loop around!
ISR0:
MOV A, P1 ; read the ADC
MOVX @DPTR, A ; save to memory location
INC DPTR ; increment memory pointer
DJNZ R6, AGAIN ; decrement R6 count: if not 0 go again
MOV IE, #00000000b ; else disable interrupt!
AGAIN:
RETI ;return from interrupt
--------------------------------------------------------------------
The assembly language program capture 250 data samples from the ADC0804 converter and store this data in external RAM starting at 2000H.
--------------------------------------------------Please Upvote----------------------------------------------------------------------------