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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/13/06 13:37
Read: times


 
#120193 - ...formatted code
Responding to: ???'s previous message
ooops, here you are, thanks!

$REGISTERBANK(0,3)                              ;register bank 0,3

                NAME            LP_MAIN

INT_CODE        SEGMENT CODE INBLOCK

MAIN_STACK              EQU     0E0H            ;stack pointer initial value

IDLE_MODE               EQU     081H            ;idle mode (SMOD = 1)
DOWN_MODE               EQU     002H            ;power down mode

                        ;output control pins definition
LEDR_PIN                EQU     0A6H            ;(P2.6) LEDR pin: red led output
LEDG_PIN                EQU     0A7H            ;(P2.7) LEDG pin: green led output
BUZZ_PIN                EQU     090H            ;(P1.0) BUZ pin: buzzer output


                ;Exeption vectors
                ;****************

                ;reset vector
                CSEG    AT      00000H
VECT_RESET:     AJMP    MAIN_RESET              ;main initialisation

                ;external interrupt 0 vector
                CSEG    AT      00003H
VECT_INTR0:     AJMP    MAIN_INIT               ;main initialisation

                ;timer 0 interrupt vector
                CSEG    AT      0000BH
VECT_TMR0:      AJMP    MAIN_INIT               ;main initialisation

                ;external interrupt 1 vector
                CSEG    AT      00013H
VECT_INTR1:     AJMP    MAIN_INT1               ;not used

                ;timer 1 interrupt vector
                CSEG    AT      0001BH
VECT_TMR1:      AJMP    MAIN_INIT               ;not used

                ;serial port interrupt vector 
                CSEG    AT      00023H
VECT_SER:       AJMP    MAIN_INIT               ;main initialisation

                ;timer 2/I2C interrupt vector
                CSEG    AT      0002BH
VECT_TMR2:      AJMP    MAIN_INIT               ;main initialisation

                RSEG    INT_CODE



MAIN_RESET:     CLR     LEDR_PIN                ;led red = reset
                SJMP    MAIN_EXEC

MAIN_INT1:      CLR     LEDG_PIN                ;led green = interrupt 1
                
MAIN_EXEC:      MOV     P0,#0E3H                ;port 0 initialisation          
                CLR     A                       ;all zero
                MOV     IE,A                    ;disable all interrupts

                ;system initialisation
                MOV     SP,#MAIN_STACK-1        ;stack pointer initialisation
                MOV     PSW,A                   ;select bank 0
                MOV     TCON,#00000101B         ;external edge interrupt
                MOV     PCON,#10000100B         ;power control disable
                MOV     08EH,#000H
                
                CLR     BUZZ_PIN                ;buzzer on
                ACALL   MAIN_WAIT               ;1 sec
                SETB    BUZZ_PIN                ;buzzer off
                ACALL   MAIN_WAIT               ;1 sec
                CLR     BUZZ_PIN                ;buzzer on
                ACALL   MAIN_WAIT               ;1 sec

MAIN_INIT:      CLR     A
                MOV     IE,A                    ;disable all interrupts
                MOV     TCON,A                  ;external level interrupt 1
                MOV     P0,#022H                ;unused bits to 0
                MOV     P1,#0FFH                ;all port high
                MOV     P2,#0FFH                ;all port high
                MOV     P3,#0FFH                ;all port high
                MOV     IE,#084H                ;enable interrupt 1
                MOV     PCON,#DOWN_MODE         ;power down
MAIN_INIT_0:    SJMP    MAIN_INIT_0



                ;wait: about 1 sec
MAIN_WAIT:      MOV     R4,#10
MAIN_WAIT_0:    MOV     R3,#200
MAIN_WAIT_1:    MOV     R2,#250
MAIN_WAIT_2:    DJNZ    R2,MAIN_WAIT_2
                DJNZ    R3,MAIN_WAIT_1
                DJNZ    R4,MAIN_WAIT_0
MAIN_WAIT_3:    RET

                END



List of 15 messages in thread
TopicAuthorDate
at89s8253 wakes up only once from pwr down.            01/01/70 00:00      
   i tried            01/01/70 00:00      
      unformatted code            01/01/70 00:00      
         sure you can            01/01/70 00:00      
            ...formatted code            01/01/70 00:00      
               mismatch            01/01/70 00:00      
                  nothing else to do.            01/01/70 00:00      
                     you should exit the interrupt by reti..            01/01/70 00:00      
                     Why does everyone insist on doing things WITHOUT e            01/01/70 00:00      
                     And then ?            01/01/70 00:00      
                        all true, but ...            01/01/70 00:00      
               Additional input            01/01/70 00:00      
   Re: at89s8253 wakes up only once from pwr down.            01/01/70 00:00      
   Thanks, everything OK            01/01/70 00:00      
      but you did not do so            01/01/70 00:00      

Back to Subject List