# 8051 assembly timer program

#### antiantianti

Joined Aug 4, 2016
45
Hi
My problem is tat when I debug this program
Everything works fine step by step until I come to the instruction JNB TF0,$and the program stays there and doesnt move to the next instruction Code: main: clr tf0 clr tr0 mov p4,#11110000b mov p2,#1 mov P3,#6H lcall delay ljmp main DELAY: MOV TH0,#0ffh MOV TL0,#0feh MOV TMOD,#1 SETB TR0 JNB TF0,$
clr tf0
clr tr0
ret
end

#### MrChips

Joined Oct 2, 2009
20,897
Hi
My problem is tat when I debug this program
Everything works fine step by step until I come to the instruction JNB TF0,$and the program stays there and doesnt move to the next instruction What do you expect to happen when the instruction JNB TF0,$ is executed?

#### antiantianti

Joined Aug 4, 2016
45

#### joeyd999

Joined Jun 6, 2011
4,373
Ok. I looked up JNB in the table of opcodes, it is 3 bytes, not 1 byte. Is that why that instruction line is failing to work?
In what way is it failing to work? What do you expect?

edit: Wait, you're not OP. Those questions are addressed to him.

#### shteii01

Joined Feb 19, 2010
4,644
In what way is it failing to work? What do you expect?

edit: Wait, you're not OP. Those questions are addressed to him.
I deleted my earlier post. I guess it would confuse people.

#### MrChips

Joined Oct 2, 2009
20,897
While in debug, examine the contents of TH0 and TL0 and confirm that the counter registers are incrementing.
Examine the contents of TCON and check that TF0 is being set when the counter overflows from FFFFh to 0000h.