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.

LED interfacing and interrupt

Status
Not open for further replies.

soh m

Newbie level 6
Joined
Jun 20, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,375
lets assume pin P3.3(INT1) is connected to a pulse generator,write a program in which the falling edge of the pulse will send a high to P1.3,which is connected to an LED.

in this problem should i have to write assembly language for LED interfacing also???
can anyone help me to write the assembly language for this problem....
i have written this....

ORG 8100H ;initialization
LJMP MAIN

;-- hardware interrupt INT1 to turn on LED

ORG 0013H ;INT1 initialization
SETB P1.3 ;LED turn on
MOV R3,#255

BACK: DJNZ R3,HERE ;keep the LED on
CLR P1.3 ;off the LED
RETI ;return

;-- main program

ORG 30H ;initialization
MAIN: SETB TCON.2
MOV IE,#10000100B ;enable external INT1

HERE: SJMP HERE ;stay until get interrupted
END

is it right??? or something need to be added??? please help me...its urgent
 

Code:
ORG 8100H ;initialization
LJMP	MAIN

;-- hardware interrupt INT1 to turn on LED

ORG 0013H ;INT1 initialization
	CLR	P1.3 ;LED turn on
	MOV	R3,#255

BACK:	DJNZ	R3,BACK ;keep the LED on 
	SET	P1.3 ;off the LED
	RETI ;return

;-- main program

ORG 30H ;initialization
MAIN:	SETB	TCON.2
	MOV	IE,#10000100B ;enable external INT1

HERE:	SJMP	HERE ;stay until get interrupted

END

It's better to pull P1.3 down and connect LED (through resistor) to Vcc, otherwise it's your code, should work ..
You may consider though moving the time delay out of the interrupt section and locate it somewhere in the main ..

:wink:
IanP
 

is this code is right??? or should i add assembly for LED interfacing?? after writing this code should i connect the LEDS to ESA51E trainer???

---------- Post added at 10:26 ---------- Previous post was at 10:20 ----------

@srikanth

initialization starts from 8100H for this device as per the manual
 

it is INTEL 80C51BH and the trainer is ESA51E
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top