Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/08/06 12:16
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#106835 - Comments
Responding to: ???'s previous message
Pris Chan said:


Actually said

counter1 EQU 40h
counter2 EQU 50h
counter3 EQU 60h
counter4 EQU 70h
org 0
    mov P1,#00h              ;set the LEDs and fans to off
    mov P3,#00h
   mov counter1,#200
   mov counter2,#200
   mov counter3,#2
   mov counter4,#2
Loop:
     acall Pressure_Up
     acall Air_Inlet_Out
     acall Pressure_Up
     acall Air_Outlet_Out
     ajmp Loop
Pressure_Up:
            setb P1.2           ;light up LED_1
            acall Dlay_2
            setb P1.3           ;light up LED_2
            acall Dlay_2
            setb P1.4           ;light up LED_3
            acall Dlay_2
            setb P1.5           ;light up LED_4
            acall Dlay_2
            setb P1.6           ;light up LED_5
            acall Dlay_2
            ret
Air_Inlet_Out:
              setb P3.0	;light up LED for air out at inlet
              setb P3.1		;switch on fan at inlet
              acall Dlay_1
		clr P1.6
		acall Dlay_1
		clr P1.5
		acall Dlay_1
		clr P1.4
		acall Dlay_1
		clr P1.3
		acall Dlay_1
		clr P1.2
		acall Dlay_1
              clr P3.0		;switch off the LED
              clr P3.1		;switch off fan at inlet
              ret
Air_Outlet_Out:
               setb P3.2	;light up LED for air out at outlet
               setb P1.7	;switch on fan at outlet
               acall Dlay_1
		clr P1.6
		acall Dlay_1
		clr P1.5
		acall Dlay_1
		clr P1.4
		acall Dlay_1
		clr P1.3
		acall Dlay_1
		clr P1.2
		acall Dlay_1
               clr P3.2		;switch off the LED
               clr P1.7		;switch off fan at outlet
               ret
Dlay_2:
        djnz counter1,Dlay_2
        mov counter1,#200
        djnz counter2,Dlay_2
        mov counter2,#200
	djnz counter3,Dlay_2
   	mov counter3,#2
   	djnz counter4,Dlay_2
   	mov counter4,#2
        ret
Dlay_1:
        djnz counter1,Dlay_1
        mov counter1,#200
        djnz counter2,Dlay_1
        mov counter2,#200
	djnz counter3,Dlay_1
	mov counter3,#2
        ret
END



Your first instruction should be to JMP out of the low part of code memory - say 100H
<pre>
ORG 0
JMP start

ORG 100H
Start: ;carry on

I don't see why you have written your delays like that. Its a bad idea to tie your processor up so it can't respond to your inputs. Use the on-chip timers and interrupts, or even just poll them

Steve




List of 16 messages in thread
TopicAuthorDate
How to auto start program once power on?            01/01/70 00:00      
   You Circuit            01/01/70 00:00      
      auto reset            01/01/70 00:00      
         Do you understand my post            01/01/70 00:00      
         Re:Auto reset            01/01/70 00:00      
            Loop appear to be random at the beginnin            01/01/70 00:00      
               Post your schematic and code            01/01/70 00:00      
                  Code            01/01/70 00:00      
                     Comments            01/01/70 00:00      
                  Schematic            01/01/70 00:00      
                     reset            01/01/70 00:00      
               Noise            01/01/70 00:00      
         Reset            01/01/70 00:00      
            RC circuit            01/01/70 00:00      
               Bad idea            01/01/70 00:00      
               Where did you get those numbers?            01/01/70 00:00      

Back to Subject List