Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

assembly help please..

Status
Not open for further replies.

albertrojo

Newbie level 4
Joined
Nov 3, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,309
i am an assembly newbie. anybody could please help me realize the output of the following code?

ORG 0000H
SJMP START
ORG 000BH
SJMP TIMER0
ORG 0030H
START: MOV SP,#60H
MOV A,#0FFH
MOV P1,A

MOV TMOD,#06H
MOV TH0,#255
MOV TL0,#255
SETB ET0
SETB TR0
SETB EA
SJMP $

TIMER0: CLR TR0
CLR C
RLC A
CJNE A,#00H,SKIP
MOV P1,A
MOV A,#0FFH
JMP SKIP1

SKIP: MOV P1,A

SKIP1: SETB TR0
RETI
END
 

Apparently, this will output the following sequence on the port 1:

0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0xfe,0xfc,0xf8... and so on.

The update rate is depending on the CPU clock.

/pisoiu
 
Apparently, this will output the following sequence on the port 1:

0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0xfe,0xfc,0xf8... and so on.

The update rate is depending on the CPU clock.

/pisoiu


thank you so much.. but, please, I truly cannot get it. actually how would it look like? appreciate it so much.:|
 

Judging after the value loaded in TMOD, the actual settings for timer is to run as an external event counter. So, the sequence I was talking about is triggered not by an interval, but by an external event. You may have there a push button or a sensor of some kind.
The sequence on the port is simple to understand if you convert from hex to binary, and it will look like this:
0xff=11111111
0xfe=11111110
0xfc=11111100
0xf8=11111000
0xf0=11110000
0xe0=11100000
0xc0=11000000
0x80=10000000
0x00=00000000
0xfe=11111110
and so on

Most probably, on each pin of P1 is a LED connected. If the led is connected between pin and +, the led will lit when the bit is 0. If the led is between pin and ground, it will lit with bit=1
So the end result is to walk through that sequence when the external bit receives a signal.
 
your program will respond to pulse applied to your uC T0 pin. when a pulse apllied, it will roll the value on port1. any way you won't notice it cos, the clock frequencies is too high. try to add some delay instruction.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top