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.

Help with switching on 8051

Status
Not open for further replies.

gpdegz

Newbie level 1
Joined
Nov 27, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
Good day to all, I'm new here, but can you please help me on my problem?
I need to create a switching sequence that uses 2 sensor as switch. one will be used as a toggle and one will be an interrupt.

I have this code so far

cseg
org 0h
ljmp Main

clr p1.7
clr p1.6
ret

org 2bh
main:
jb p3.4, $
call delay
clr p1.7
setb p1.6
call stop

jnb p3.4, $
call delay
setb p1.7
clr p1.6
call stop

sjmp main

stop:
setb p1.7
setb p1.6
ret

delay:
Del_1_Sec: MOV R3,#8
MOV R2,#8
MOV R1,#236
Del_1_Sec0:
DJNZ R1,Del_1_Sec0
DJNZ R2,Del_1_Sec0
DJNZ R3,Del_1_Sec0
RET
end

It supposed to, on sensor 1 low which is 3.4 will light up port 1.6 and port 1.7 every time it goes to high. while 3.1 will be used as interrupt
that will light up 1.6 and 1.7 at the same time.

Regards and more powers
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top