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.
Hello, thank you for your answer! At this moment i'm not using the circuit itself, just simulating with the reg515C.inc library. I think we use 80C515C in class.
the simulator ia as far from real time as the east is from the west
Erik
Thank you very much for your answer, i haven't been connected this days.
Best regards, Julio.