Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/01/99 19:38
Read: times


 
#920 - RE: Can somebody check this code plz.
Hi Mudasar,

You are doing quite right, in general. But...there are some notes.

1) You may put the value into the 8-bit accumulator not greater 0FFH=255.

2) If you use 4 MHz rezonator the machine cycle is equal 3 us=1/(4 MHz/12).

3) Instruction INC A takes 1 cycle and CJNE - 3 cycles so one delay loop takes 4 cycles or 12 us. For 1000 ms you have to make 83=1000/12 delay loops.

4) The shorter subroutine DELAY is following:
DELAY: MOV A,#167
DEL05: DJNZ A,DEL05
RET

5) The shorter main program is following:
START: CLR P2.1
ALT: CPL P2.1
CALL DELAY
JMP ALT

Hope it helps you to write the better program.

Bye,

Igor

List of 4 messages in thread
TopicAuthorDate
Can somebody check this code plz.            01/01/70 00:00      
RE: Can somebody check this code plz.            01/01/70 00:00      
RE: Can somebody check this code plz.            01/01/70 00:00      
RE: Can somebody check this code plz.            01/01/70 00:00      

Back to Subject List