This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Timer, Ports, I/O

Hello everyone! I'd like to introduce myself, my name is Julio, i'm from Spain and i'm starting to study assembler for C51 this year in college. I have a question and i'm sure that you would be able to help me, since i'm still novice.

This is the code from my program, it's a simple one that only changes the value of a bit every second within a minute, that bit is the one that turn on/off a LED in the laboratory card.
Now i'm at home and i'd like to check if the code will work.
This is the code:

$nomo
$include(C:\Keil\C51\ASM\reg515C.inc)
cseg at 0000h

LJMP Start
PIN equ P4.0
org 0100h
Start:          MOV R1,#60d
loop1:          MOV R0,#20d
loop2:          CLR TR1
                CLR TF1
                MOV TMOD, #10h
                MOV TL1,#0B0h
                MOV TH1,#3Ch
                SETB TR1
                JNB TF1,$
                DJNZ R0,loop2
                CPL PIN
                DJNZ R1,loop1
                SJMP $
                end

The maths i'm using for it is=>
oscilator frequency=6MHz (i set it from Periphals -> System configuration -> XTAL Freq)
That does 1.000.000 cpu cycles within a second, so, 2^15= 65536, 50 ms = 50.000 us,
65536-50000=15536=3CB0h, that's what i put in TH1/TL1.

When i'm using Periphals -> I/O Ports -> Port 4, i can't see the bit 0 changing it's value its complementary every second.
Can someone please tell me why?

Thank you very much in advance.

PS: I'm using an evaluation version of uVision3.

Parents Reply Children
No data