Anyone who gives the correct answer first will get 10 marks in lab03....
Question: In the following program, what should be the value of COUNT so that the instructions in LOOP execute maximum no. of times.
In ur answer please give the value of COUNT for maximum iterations, and also state the reason why u think that a particular value will result in max iterations of the loop. Also post ur name and student id in the comments along with ur answer.
Question: In the following program, what should be the value of COUNT so that the instructions in LOOP execute maximum no. of times.
ORG 0H
COUNT EQU 0X20
PORTB EQU 0X06
TRISB EQU 0X86
STATUS EQU 0X03
BSF STATUS,5
MOVLW B'0'
MOVWF TRISB
BCF STATUS,5
;/***************************************/
MOVLW D'???'
MOVWF COUNT
LOOP
MOVLW B'0'
MOVWF PORTB
MOVLW B'1'
MOVWF PORTB
DECFSZ COUNT
GOTO LOOP
;/**************************************/
HERE GOTO HERE
END
In ur answer please give the value of COUNT for maximum iterations, and also state the reason why u think that a particular value will result in max iterations of the loop. Also post ur name and student id in the comments along with ur answer.
valid reason is a must...
ReplyDeleteD'255' is the value in which the loop execute Maximum times Because we have 0x20 is 8 bit register and because of this maximum 255 iterations are possible.
ReplyDeleteName :Faizan Faisal Wali
SID:5422
CID:14308
tum wohi ho jis se kal main gate pe mulaquaat hoi thi??? i'm terrible at remembering names...
DeleteYES SIR!!
DeleteIs my answer correct or not ???
DeletePlz Tell sir if my answer is incorrect.
I'll try again :)
But in My opinion this is probably the correct answer...
DEAD LINE for submitting the correct answer is 9th Sep (sunday) 10pm.
DeleteBefore that i wont disclose the correct answer.
@Faizan
agar tmhara answer ghalat hoa to next lab me ZERO du ga tmhe...
Sir Now I am 63H% Sure That my answer is correct!!
Delete:):D
I think both your answer and reason are right:) confirmed with datasheet
DeleteAssalam o alaikum sir i think the maximum value of count should be 255 as in the above program every single count will execute instructions in loop for one time so if we want instructions of loop to be executed for maximum no. of time then the value of 8-bit count register should be maximum i.e. 255(FFH)..........
DeleteName:Madiha Razzaq
ID:5682
CID:14308
WKSalam
Delete8 bit register gives 2^8=256 or from 0 to 255 so D'255' should be the maximum value for maximum number of loops to be executed.
ReplyDeleteSAAD RABBANI (5680)
CID:14308
Since everyone else is doing it too:
ReplyDeleteThe value of COUNT will be 255 (D'255') because the general purpose register 0x20 is an eight bit register which can hold up to 255.
The datasheet also states that the MOVLW instruction uses literal values (0-255).
Muhammad Ammar Hassan (5501)
CID: 14308
The answer might actually be 00H instead because in a register it corresponds to 256. 00H will decrement to FFH.
Delete14308...14308...14308...
ReplyDeletethe count will be executed to 255 times starting with 0. the gpr can handle values uptill 8 bit
ReplyDeleteName: Asad Jabbar
Sid: 5459
cid: 14308
0xFF should be the value of COUNT in order to get maximum iterations.. because the COUNT register is a 8-bit register so it can store 256 values. i.e 0-255
ReplyDelete255=FFh
SAJID BALOCH(5448)
14308
5434- HAFIZ DANYAL HUSSAIN
ReplyDeleteC.ID: 14308
255 must be the maximum value because of the 8-bit register having 256 possible values to store. that is 0-255 so the maximum value of COUNT must be 255.
The maximum value for count will be 255 because of 8 bit register.
ReplyDeleteS.Imbisat Hussain(5542)
CID: 14308
Note: The "first" one to give the CORRECT answer would be awarded marks so if u have an answer other than FFh (0-255) then please try otherwise , enjoy
ReplyDelete