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.

Loop program jump another subroutine

Status
Not open for further replies.

lockman_akim

Advanced Member level 1
Joined
Jul 12, 2010
Messages
466
Helped
76
Reputation
152
Reaction score
68
Trophy points
1,308
Location
Malaysia
Activity points
3,523
i give an example of my problem,

i try to make simple alarm.

i attach the vibrate sensor to pic..when sense vibrate, it will execute subroutine A but if i push button it will jump out from that subroutine A to subroutine B ..the problem is, it only read the "if" command at first it go in the subroutine A..so button will not function at all..
how can i solve this?

my program is in BASIC

alarm_on:

if portd.0 = 0 then
goto alarm_off
end if

portb.0 = 1
delayms 1000
portb.0 = 0
delayms 1000

portb.0 = 1
delayms 1000
portb.0 = 0
delayms 1000

portb.0 = 1
delayms 1000
portb.0 = 0
delayms 1000

goto start
 

it been a long time i leave basic to program uC. i used assembler to program it. any way it seem there is a mess with your if-then structure.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top