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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/17/04 07:10
Read: times


 
Msg Score: 0
 -1 Didn't Search First
 +1 Underrated
#77537 - RE: Priority interrupt problem with DS5240
Responding to: ???'s previous message
I have already checked the code, it is quite simple and
I did not see anything strange.

Here you are the interrupt routines:

**************************************
**** INTERRUPT FROM TIMER 0 ********
**************************************

; /*
; ////////////////////////////////////////////////
; // Funzione com_timer
; // Descrizione: gestione interrupt Timer 0 per
; // timer virtuali
; // Autore Vico Lupori
; // Data: Maggio 2002
; ////////////////////////////////////////////////
; */
;
; void timer0 (void) interrupt 1 using 3

RSEG ?PR?timer0?TIMER
USING 3
timer0:
PUSH ACC
PUSH PSW
USING 3
MOV PSW,#018H
; SOURCE LINE # 94
; {
; data unsigned char data *ptabella; //pointer a unsigned char data in data
; data unsigned char i;
;
; TR0 = 0; //stop timer 0
; SOURCE LINE # 99
CLR TR0
;
; //Gestione timer virtuale
; //Incrementa timer di debug
; #ifdef MONITORSERIALE
; timer_debug++;
; SOURCE LINE # 104
INC timer_debug+01H
MOV A,timer_debug+01H
JNZ ?C0017
INC timer_debug
?C0017:
; #endif
;
; //Inizia con tabella timer 10 millisecondi
; ptabella = (unsigned char data*) &timer10ms; //inizializza puntatore a tabella
; SOURCE LINE # 108
MOV R7,#LOW (timer10ms)
MOV ptabella?140,#LOW (timer10ms)
; for( i = 0; i < LENTIMER10MS; i++ )
; SOURCE LINE # 109
MOV i?141,#00H
?C0002:
; {
; SOURCE LINE # 110
; if( (*ptabella) !=0 )
; SOURCE LINE # 111
MOV R0,ptabella?140
MOV A,@R0
JZ ?C0005
; {
; SOURCE LINE # 112
; (*ptabella)--;
; SOURCE LINE # 113
DEC @R0
; }
; SOURCE LINE # 114
?C0005:
; ptabella++;
; SOURCE LINE # 115
; }
; SOURCE LINE # 116
ACALL L?0020
CJNE A,#06H,?C0002
?C0003:
;
; //Se prescaler tabella 50 ms esaurito vai a tabella 50 ms
; if( --prescaler_50ms == 0 )
; SOURCE LINE # 119
DEC prescaler_50ms
MOV A,prescaler_50ms
JNZ ?C0006
; {
; SOURCE LINE # 120
; prescaler_50ms = VALUE_50MS;
; SOURCE LINE # 121
MOV prescaler_50ms,#05H
;
; ptabella = (unsigned char data*)&timer50ms; //inizializza puntatore a tabella
; SOURCE LINE # 123
MOV R7,#LOW (timer50ms)
MOV ptabella?140,#LOW (timer50ms)
; for( i = 0; i < LENTIMER50MS; i++ )
; SOURCE LINE # 124
MOV i?141,A
?C0007:
; {
; SOURCE LINE # 125
; if( (*ptabella) !=0 )
; SOURCE LINE # 126
MOV R0,ptabella?140
MOV A,@R0
JZ ?C0010
; {
; SOURCE LINE # 127
; (*ptabella)--;
; SOURCE LINE # 128
DEC @R0
; }
; SOURCE LINE # 129
?C0010:
; ptabella++;
; SOURCE LINE # 130
;
; }
; SOURCE LINE # 132
ACALL L?0020
CJNE A,#05H,?C0007
?C0008:
;
; //Se prescaler tabella 1 sec esaurito vai a tabella 1 sec
; if( --prescaler_1sec == 0 )
; SOURCE LINE # 135
DEC prescaler_1sec
MOV A,prescaler_1sec
JNZ ?C0006
; {
; SOURCE LINE # 136
; prescaler_1sec = VALUE_1SEC;
; SOURCE LINE # 137
MOV prescaler_1sec,#014H
; ptabella = (unsigned char data*)&timer1sec; //inizializza puntatore a tabella
; SOURCE LINE # 138
MOV R7,#LOW (timer1sec)
MOV ptabella?140,#LOW (timer1sec)
; for( i = 0; i < LENTIMER1SEC; i++ )
; SOURCE LINE # 139
MOV i?141,A
?C0012:
; {
; SOURCE LINE # 140
; if( (*ptabella) !=0 )
; SOURCE LINE # 141
MOV R0,ptabella?140
MOV A,@R0
JZ ?C0015
; {
; SOURCE LINE # 142
; (*ptabella) --;
; SOURCE LINE # 143
DEC @R0
; }
; SOURCE LINE # 144
?C0015:
; ptabella++;
; SOURCE LINE # 145
; }
; SOURCE LINE # 146
ACALL L?0021
CJNE A,#01H,?C0012
;
; }
; SOURCE LINE # 148
;
; }
; SOURCE LINE # 150
?C0006:
; TL0 = (unsigned char)LO_T0; /* carica parte bassa timer 0 */
; SOURCE LINE # 151
MOV TL0,#0E2H
; TH0 = (unsigned char)HI_T0; /* carica parte alta timer 0 */
; SOURCE LINE # 152
MOV TH0,#0DBH
; TR0 = 1; //go timer 0
; SOURCE LINE # 153
SETB TR0
; }
; SOURCE LINE # 154
POP PSW
POP ACC
RETI
; END OF timer0

**************************************
**** INTERRUPT FROM SERIAL 0 ********
**************************************
; /*
; ////////////////////////////////////////////////
; // Funzione com_isr
; // Descrizione: gestione interrupt seriale
; // Autore Vico Lupori
; // Data: Maggio 2002
; ////////////////////////////////////////////////
; */

RSEG ?PR?ISERIAL
Com001F:
L?0032:
USING 2
DEC A
ADD A,#LOW (rbuf)
MOV DPL,A
MOV A,#HIGH (rbuf)
L?0033:
ADDC A,R6
MOV DPH,A
MOV DPX,#?C?XDATASEG
RET
L?0034:
USING 0
CLR A
MOV t_in,A
MOV t_in+01H,A
MOV t_out,A
MOV t_out+01H,A
MOV t_count,A
MOV t_count+01H,A
SETB t_disabled
RET
; END OF Com001F

CSEG AT 00823H
LJMP com_isr

; void com_isr (void) interrupt 4 using 2

RSEG ?PR?com_isr?ISERIAL
USING 2
com_isr:
PUSH ACC
PUSH DPX
PUSH DPH
PUSH DPL
PUSH DPX1
PUSH DPH1
PUSH DPL1
PUSH DPS
MOV DPS,#00H
PUSH PSW
USING 2
MOV PSW,#010H
; SOURCE LINE # 64
; {
; if (RI != 0) /* Received data interrupt */
; SOURCE LINE # 66
JNB RI,?C0001
; {
; SOURCE LINE # 67
; RI = 0;
; SOURCE LINE # 68
CLR RI
;
; //inserisci carattere in buffer circolare ricezione
; if( r_count < RBUF_SIZE )
; SOURCE LINE # 71
CLR C
MOV A,r_count+01H
SUBB A,#01AH
MOV A,r_count
SUBB A,#04H
JNC ?C0001
; {
; SOURCE LINE # 72
; ACC = SBUF0; //carico in accumulatore per settare bit P di PSW
; SOURCE LINE # 73
MOV A,SBUF0
; if( RB8 == P )
; SOURCE LINE # 74
MOV C,RB8
JNB P,?C0022
CPL C
?C0022:
JC ?C0001
; {
; SOURCE LINE # 75
; r_count++;
; SOURCE LINE # 76
INC r_count+01H
MOV A,r_count+01H
JNZ ?C0023
INC r_count
?C0023:
; rbuf[ r_in++ ] = SBUF0;
; SOURCE LINE # 77
INC r_in+01H
MOV A,r_in+01H
MOV R6,r_in
JNZ ?C0024
INC r_in
?C0024:
ACALL L?0032
MOV A,SBUF0
MOVX @DPTR,A
; if( r_in > RBUF_SIZE-1 )
; SOURCE LINE # 78
SETB C
MOV A,r_in+01H
SUBB A,#019H
MOV A,r_in
SUBB A,#04H
JC ?C0001
; r_in = 0;
; SOURCE LINE # 79
MOV r_in,#00H
MOV r_in+01H,#00H
;
; }
; SOURCE LINE # 81
; }
; SOURCE LINE # 82
; }
; SOURCE LINE # 83
?C0001:
;
; if (TI != 0) // Transmitted data interrupt
; SOURCE LINE # 85
JNB TI,?C0009
; {
; SOURCE LINE # 86
; TI = 0;
; SOURCE LINE # 87
CLR TI
;
; //trasmette un carattere dal buffer circolare
; if( t_count != 0 )
; SOURCE LINE # 90
MOV A,t_count+01H
ORL A,t_count
JZ ?C0006
; {
; SOURCE LINE # 91
; ACC = tbuf[ t_out ]; //load dato in accumulatore per condizionare il bit P di PSW
; SOURCE LINE # 92
MOV R6,t_out
MOV R7,t_out+01H
MOV A,#LOW (tbuf)
ADD A,R7
MOV DPL,A
MOV A,#HIGH (tbuf)
ACALL L?0033
MOVX A,@DPTR
; TB8 = P;
; SOURCE LINE # 93
MOV C,P
MOV TB8,C
; SBUF0 = tbuf[ t_out++ ];
; SOURCE LINE # 94
INC t_out+01H
MOV A,t_out+01H
MOV R6,t_out
JNZ ?C0025
INC t_out
?C0025:
DEC A
ADD A,#LOW (tbuf)
MOV DPL,A
MOV A,#HIGH (tbuf)
ACALL L?0033
MOVX A,@DPTR
MOV SBUF0,A
; t_count--;
; SOURCE LINE # 95
MOV A,t_count+01H
DEC t_count+01H
JNZ ?C0026
DEC t_count
?C0026:
; if( t_out > TBUF_SIZE-1 )
; SOURCE LINE # 96
SETB C
MOV A,t_out+01H
SUBB A,#019H
MOV A,t_out
SUBB A,#04H
JC ?C0009
; t_out = 0;
; SOURCE LINE # 97
MOV t_out,#00H
MOV t_out+01H,#00H
; }
; SOURCE LINE # 98
SJMP ?C0009
?C0006:
; else
; t_disabled = 1;
; SOURCE LINE # 100
SETB t_disabled
; }
; SOURCE LINE # 101
;
; }
; SOURCE LINE # 103
?C0009:
POP PSW
POP DPS
POP DPL1
POP DPH1
POP DPX1
POP DPL
POP DPH
POP DPX
POP ACC
RETI
; END OF com_isr

;





List of 43 messages in thread
TopicAuthorDate
Priority interrupt problem with DS5240            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      RE: Priority interrupt problem with DS5240            01/01/70 00:00      
         RE: Priority interrupt problem with DS5240            01/01/70 00:00      
            RE: Priority interrupt problem with DS5240            01/01/70 00:00      
            RE: Priority interrupt problem with DS5240            01/01/70 00:00      
   just a thought            01/01/70 00:00      
      RE: just a thought            01/01/70 00:00      
         RE: just a thought            01/01/70 00:00      
            RE: just a thought            01/01/70 00:00      
               RE: just a thought            01/01/70 00:00      
                  RE: just a thought            01/01/70 00:00      
                     RE: just a thought            01/01/70 00:00      
                        RE: just a thought            01/01/70 00:00      
                           RE: just a thought            01/01/70 00:00      
                  RE: just a thought            01/01/70 00:00      
   Avoid USING !            01/01/70 00:00      
      RE: Avoid USING !            01/01/70 00:00      
         caught it myseld            01/01/70 00:00      
      RE: Avoid USING !            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      RE: Priority interrupt problem with DS52            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      Get rid of USING            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      use using ???            01/01/70 00:00      
   Resolved?            01/01/70 00:00      
   My USING experience            01/01/70 00:00      
      RE: My USING experience            01/01/70 00:00      
         Resolved ? ... I don\'t know            01/01/70 00:00      
   !! PROBLEM SOLVED!!!!            01/01/70 00:00      
      Which compiler?            01/01/70 00:00      
         RE: Which compiler?            01/01/70 00:00      
      RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
         RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
            RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
      RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
         RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
            RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      RE: Priority interrupt problem with DS5240            01/01/70 00:00      
         RE: Priority interrupt problem with DS5240            01/01/70 00:00      

Back to Subject List