[C][ASM] Programmazione PIC 16F84A

Qui vengono spostati discussioni e messaggi ritenuti inadeguati per il contenuto o la forma con cui sono stati espressi.
Avatar utente
ubuntumate
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1180
Iscrizione: giovedì 28 maggio 2015, 18:18
Distribuzione: Windows 7
Sesso: Maschile
Località: Milano

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da ubuntumate »

A scuola sono costretto a scrivere in C e usiamo il vecchio compilatore HITECH o qualcosa del genere,ma io uso xc8 e le funzioni di delay,DelayMs e DelayUs,non vengono trovate... come posso fare?
Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.
ACM/IEEE Code of ethics.
Avatar utente
M_A_W_ 1968
Scoppiettante Seguace
Scoppiettante Seguace
Messaggi: 856
Iscrizione: venerdì 15 febbraio 2013, 3:57
Desktop: KDE
Distribuzione: SuSE
Sesso: Maschile
Località: Un luogo geometrico
Contatti:

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da M_A_W_ 1968 »

Nel modo più classico fin dalla notte dei tempi della IT: usando il preprocessore e le macro predefinite, riportate nei rispettivi manuali dei vari compilatori.

Codice: Seleziona tutto

#ifdef HI_TECH_C
 bla, bla, bla, bla
 #define DelayMS HITECH_Delay_Function
#else
 blou, bli, bleh
#endif
Se guardi qualche sorgente multitarget piuttosto semplice (ad esempio anche il classico infozip) troverai caterve di tali esempi d'uso avanzato del preprocessore.
Sì, un blog ce l'ho perfino io: gli è che mi manca il tempo...

"...in una società che sembra sempre più spaventata dai problemi troppo articolati e che rigetta come un corpo estraneo ogni elemento di complessità, sapremo ancora come utilizzare il parere degli esperti?"
Avatar utente
ubuntumate
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1180
Iscrizione: giovedì 28 maggio 2015, 18:18
Distribuzione: Windows 7
Sesso: Maschile
Località: Milano

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da ubuntumate »

Perdonami @MAW: non mi sono spiegato bene. Prima volevo dire che DelayMs dell'HITECH e _delay_ms() citata nel manuale di XC8 non funzionano. La colpa è mia che non ho visto che delay_ms() deve essere preceduta da DUE underscore. Scusami :shy: :muro: :(
Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.
ACM/IEEE Code of ethics.
Avatar utente
ubuntumate
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1180
Iscrizione: giovedì 28 maggio 2015, 18:18
Distribuzione: Windows 7
Sesso: Maschile
Località: Milano

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da ubuntumate »

È lecito usare RFL/RRF su PORTB o anch'essa è affetta dal problema RMW (read-modify-write)? In C

Codice: Seleziona tutto

while(PORTB < LIMIT)
{
    PORTB <<= 1;
    __delay_ms(DELAY);
}
e in ASM

Codice: Seleziona tutto

main
    RLF PORTB,1
    call delay100ms
    goto main
non sortiscono alcun effetto: l'idea sarebbe quella di creare l'effetto supercar sfruttando i pin da RB0 a RB5,ma nella pratica il primo led rimane accesso e non succede nient'altro.


EDIT:
Ho scritto il codice riportato più sotto e funziona

Codice: Seleziona tutto

;Simulatore di supercar usando RLF/RRF
PROCESSOR   p16f84a
RADIX       DEC
INCLUDE     "p16f84a.inc"
 __CONFIG  11111111111001b     ; no code protect, no pwrt, no wdt, XT oscill.
 
ORG 0                          ; il programma inizia da 0
    goto init

ORG 4
    ; nessuna gestione degli interrupt prevista

init
    bsf     STATUS,RP0          ; Bank 1
    clrf    TRISB               ; tutte le linee di PORTB sono uscite
    movlw   0xFF                ; imposto TRISA come ingressi
    movwf   TRISA               ; """""""""""""""""
    bcf     OPTION_REG,T0CS     ; seleziono oscillatore al quarzo come sorgente
    bcf     OPTION_REG,PSA      ; prescaler assegnato a TMR0
    bsf     OPTION_REG,PS0      ; prescaler a 1:256
    bsf     OPTION_REG,PS1      ;""
    bsf     OPTION_REG,PS2      ;""
    
    bcf     STATUS,RP0          ; Bank 0
    movlw   0x01                ; RB = 0
    movwf   PORTB               ;""
    goto main
    
main
    movlw   5                   ; uso le uscite fino a RB5
    movwf   0Ch

    call    wait100ms           ; attendo 100 millisecondi
    rlf     PORTB,1             ; shift a sx di PORTB
    decfsz  0Ch,1               ; se 0Ch = 0 non ripeto
    goto    $-3
    
    movlw   5                   ; come sopra ma con shift a dx
    movwf   0Ch

    call    wait100ms
    rrf     PORTB,1
    decfsz  0Ch,1
    goto    $-3
    
    goto    main

    
wait50ms                        ; genera un ritardo di 50ms
    bcf     INTCON,T0IF         ; TMR0 non è in overflow
    movlw   61
    movwf   TMR0                ; imposto TMR0 a 61 per aver 50ms di delay
    btfss   INTCON,T0IF         ; se non il bit di overflow = 0
    goto    $-1                 ; torno all'istruzione precedente
    return                      ; fine routine

wait100ms                       ; ritardo di 0,1 secondi
    call    wait50ms
    call    wait50ms
    return
END
Scusare l'indentazione,ma non conosco software come Astyle per assembly ed expand non ha funzionato.
Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.
ACM/IEEE Code of ethics.
Avatar utente
ubuntumate
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1180
Iscrizione: giovedì 28 maggio 2015, 18:18
Distribuzione: Windows 7
Sesso: Maschile
Località: Milano

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da ubuntumate »

Consegna: " Scrivere un programma per PIC 16F84A con relativa routine di interrupt. Di norma il firmware deve impostare a 1 RA1, ma in caso di interrupt su RB0, i pin RA1 ed RA2 devono essere messi a1 per 250 ms e a 0 per altri 250 ms per 4 volte. "

Andava scritto in C, ma è troppo semplice e noioso così l'ho fatto in assembly. Posto il codice sperando di ottenere qualche suggerimento. Non ho studiato nulla a riguardo perché ho già molto altro da leggere al momento, quindi il codice è quello che è.

Codice: Seleziona tutto

;-------------------------------------------------------------------
; INFO
;-------------------------------------------------------------------
PROCESSOR   p16f84a
RADIX	    DEC
INCLUDE	    "p16f84a.inc"
__CONFIG  11111111111001b
;---------------------------------------------------------------------
; SETUP
;---------------------------------------------------------------------
ORG 0
    goto setup
ORG 4
    goto int_handler

setup
    bsf	    STATUS,RP0		; BANK 1
    bsf	    INTCON,GIE		; interrupt attivi
    bsf	    INTCON,INTE		; interrupt su RB0 attivo
    bsf	    OPTION_REG,INTEDG	; interrupt sul fronte di salita
    bcf	    OPTION_REG,PSA	; prescaler a TMR0
    bsf	    OPTION_REG,PS0	; prescaler 1:256
    bsf	    OPTION_REG,PS1
    bsf	    OPTION_REG,PS2
    bcf	    OPTION_REG,T0CS	; clock interno per le istruzioni
    movlw   0x00		; PORTA output
    movwf   TRISA
    movlw   0xFF		; PORTB input
    movwf   TRISB
    bcf	    STATUS,RP0		; BANK 0
    goto    main		; inizializzazione dei registri terminata
main
    movlw   0x06		; RA2 e RA1 a livello alto
    movwf   PORTA
    goto main
; ritardo di 50 millisecondi
wait50ms
  bcf       INTCON,T0IF         ; non c'è overflow su TMR0
  movlw     61                  ; 256 - (50 ms / 0.256 ms)
  movwf     TMR0
  btfss     INTCON,T0IF         ; se non overflow
  goto      $-1                 ; ripeti
  return
; aspetta 100 ms
wait100ms
  call wait50ms
  call wait50ms
  return
; ritardo di 500 ms
wait500ms
  call wait100ms
  call wait100ms
  call wait100ms
  call wait100ms
  call wait100ms
  return
; azioni per l'interrupt
int_action
    bcf	    STATUS,RP0	    ; BANK 0
    movlw   0x04
    movwf   0Ch		    ; il registro 0Ch viene usato come contatore
redo
    movlw   0x02	    ; RA1 è a 1
    movwf   PORTA
    call    wait100ms	    ; ritardo di 250ms
    call    wait100ms
    call    wait50ms
    movlw   0x00	    ; PORTA tutta a 0
    movwf   PORTA
    call    wait100ms	    ; ritardo di 250ms
    call    wait100ms
    call    wait50ms
    decfsz  0Ch,1	    ; salta la prossima istruzione se 0Ch == 0
    goto    redo
    bsf	    STATUS,RP0	    ; BANK 1
    return
; routine di interrupt
int_handler
    bsf	    STATUS,RP0	    ; BANK 1
    bcf	    INTCON,GIE	    ; interrupt disattivati
    btfsc   INTCON,INTF	    ; se c'è un interrupt su RB0
    call    int_action	    ; esegue le dovute azioni
    bsf	    INTCON,GIE	    ; ri-abilita globalmente gli interrupt
    bcf	    INTCON,INTF	    ; azzera l'indicatore di interruzione
    bcf	    STATUS,RP0	    ; BANK 0
    return  
END
Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.
ACM/IEEE Code of ethics.
gila75
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2739
Iscrizione: mercoledì 16 gennaio 2013, 17:28
Desktop: ubuntu-2d
Distribuzione: Ubuntu 12.04.2 LTS i686
Località: Airuno(Lecco)

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da gila75 »

Magari centra poco, ma forse ti è utile sapere (non ho controllato se l'hai fatto) che prima dell'interrupt bisogna salvare i vari stati.
Non ricordo se il registro status o cosa, per poi ripristinare il tutto a fine interrupt.
Non vorrei dire una cavolata, ma forse si usava swap, devo vedere.
Avatar utente
ubuntumate
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1180
Iscrizione: giovedì 28 maggio 2015, 18:18
Distribuzione: Windows 7
Sesso: Maschile
Località: Milano

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da ubuntumate »

Ciao @gila, a quali stati ti riferisci? A quelli di PORTA e PORTB?
Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.
ACM/IEEE Code of ethics.
Avatar utente
Claudio_F
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1463
Iscrizione: lunedì 28 maggio 2012, 18:49
Desktop: Mate/Gnome
Distribuzione: Ubu22.04

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da Claudio_F »

Normalmente sono da salvare tutti i registri del processore che verranno modificati dalla ISR, in un PIC sicuramente il registro W e lo STATUS, ma a seconda dei casi ne potrebbe servire qualcun altro (ad esempio PCLATH).

Ma questo non è sempre necessario, ad esempio se il main dopo il setup non deve fare più nulla e tutto il lavoro viene svolto sotto interrupt, non serve salvare/ripristinare nessun contesto.

Nota che nel tuo caso invece il main continua sempre a fare qualcosa:

Codice: Seleziona tutto

main
    movlw   0x06      ; RA2 e RA1 a livello alto
    movwf   PORTA
    goto main
metti che arrivi un interrupt tra la movlw e la movwf, il valore successivamente scritto in PORTA non è 0x06, ma il valore di che W assume nella ISR. Se invece scrivevi:

Codice: Seleziona tutto

main
    movlw   0x06      ; RA2 e RA1 a livello alto
    movwf   PORTA
loop
    goto loop
allora non si verificherebbe nessun effetto collaterale.
gila75
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2739
Iscrizione: mercoledì 16 gennaio 2013, 17:28
Desktop: ubuntu-2d
Distribuzione: Ubuntu 12.04.2 LTS i686
Località: Airuno(Lecco)

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da gila75 »

in un PIC sicuramente il registro W e lo STATUS
Si, a quello mi riferivo.
Devo cercare nella cartella dimenticata dei pic l'esempio.
Ovvio non sempre potrebbe essere necessario, ma ricordo una volta che al ritorno dell'interrupt avevo dei casi strani.
Poi con impazzimenti vari, mi pareva fosse il W a essere cambiato.
Avatar utente
ubuntumate
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1180
Iscrizione: giovedì 28 maggio 2015, 18:18
Distribuzione: Windows 7
Sesso: Maschile
Località: Milano

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da ubuntumate »

Non avevo pensato di dover simulare un context-switch in miniatura...mi è venuta la curiosità di andare a vedere se il compilatore C si fa carico di questo problema. Ecco il codice in C

Codice: Seleziona tutto

#include <xc.h>
#define DELAY (250U)
#define REPEAT (4U)
#define _XTAL_FREQ (4000000U)

void interrupt handle_int(void);

void main(void)
{
    TRISA = 0x00;
    TRISB = 0xFF;
    GIE = 1;
    INTE = 1;
    INTEDG = 1;
    
    PORTA = 0x00;
    while(1)
    {
            PORTA = 0x06;
    }
}
/* Routine di interrupt*/
void interrupt handle_int(void)
{
    unsigned int i = 0;
    GIE = 0;
    if(INTF == 1)
    {
        while(i < REPEAT)
        {
            PORTA = 0x02;
            __delay_ms(DELAY);
            PORTA = 0x00;
            __delay_ms(DELAY);
            ++i;
        }
        
    }
    GIE = 1;
    INTF = 0;
}
e l'output di XC8:

Codice: Seleziona tutto



Microchip Technology PIC PRO Macro Assembler V1.37 build -260352376 
                                                                                               Sat Apr 16 17:33:37 2016

Microchip Technology Omniscient Code Generator v1.37 (PRO mode) build 201603110536
     1                           	processor	16F84A
     2                           	opt	pw 120
     3                           	opt	pm
     4                           	psect	cinit,global,class=CODE,merge=1,delta=2
     5                           	psect	cstackCOMMON,global,class=COMMON,space=1,delta=1
     6                           	psect	cstackBANK0,global,class=BANK0,space=1,delta=1
     7                           	psect	maintext,global,class=CODE,split=1,delta=2
     8                           	psect	text1,local,class=CODE,merge=1,delta=2
     9                           	psect	intentry,global,class=CODE,delta=2
    10                           	psect	pa_nodes,global,class=CODE,delta=2
    11                           	dabs	1,0x4E,2
    12  0000                     	;# 
    13  0001                     	;# 
    14  0002                     	;# 
    15  0003                     	;# 
    16  0004                     	;# 
    17  0005                     	;# 
    18  0006                     	;# 
    19  0008                     	;# 
    20  0009                     	;# 
    21  000A                     	;# 
    22  000B                     	;# 
    23  0081                     	;# 
    24  0085                     	;# 
    25  0086                     	;# 
    26  0088                     	;# 
    27  0089                     	;# 
    28  0005                     _PORTA	set	5
    29  005F                     _GIE	set	95
    30  005C                     _INTE	set	92
    31  0059                     _INTF	set	89
    32  0085                     _TRISA	set	133
    33  0086                     _TRISB	set	134
    34  040E                     _INTEDG	set	1038
    35                           
    36                           	psect	cinit
    37  000C                     start_initialization:	
    38                           ; #config settings
    39                           
    40  000C                     __initialization:	
    41  000C                     end_of_initialization:	
    42                           ;End of C runtime variable initialization code
    43                           
    44  000C                     __end_of__initialization:	
    45  000C  0183               	clrf	3
    46  000D  2846               	ljmp	_main	;jump to C main() function
    47                           
    48                           	psect	cstackCOMMON
    49  0000                     __pcstackCOMMON:	
    50  0000                     ??_main:	
    51                           
    52                           	psect	cstackBANK0
    53  000C                     __pcstackBANK0:	
    54                           ; 1 bytes @ 0x0
    55                           
    56  000C                     ?_main:	
    57  000C                     ?_handle_int:	
    58                           ; 1 bytes @ 0x0
    59                           
    60  000C                     ??_handle_int:	
    61                           ; 1 bytes @ 0x0
    62                           
    63                           
    64                           ; 1 bytes @ 0x0
    65  000C                     	ds	5
    66  0011                     handle_int@i:	
    67                           
    68                           ; 2 bytes @ 0x5
    69  0011                     	ds	2
    70                           
    71                           	psect	maintext
    72  0046                     __pmaintext:	
    73 ;;
    74 ;;Main: autosize = 0, tempsize = 0, incstack = 0, save=0
    75 ;;
    76 ;; *************** function _main *****************
    77 ;; Defined at:
    78 ;;		line 8 in file "int.c"
    79 ;; Parameters:    Size  Location     Type
    80 ;;		None
    81 ;; Auto vars:     Size  Location     Type
    82 ;;		None
    83 ;; Return value:  Size  Location     Type
    84 ;;                  1    wreg      void 
    85 ;; Registers used:
    86 ;;		wreg, status,2
    87 ;; Tracked objects:
    88 ;;		On entry : B00/0
    89 ;;		On exit  : B00/0
    90 ;;		Unchanged: A00/0
    91 ;; Data sizes:     COMMON   BANK0
    92 ;;      Params:         0       0
    93 ;;      Locals:         0       0
    94 ;;      Temps:          0       0
    95 ;;      Totals:         0       0
    96 ;;Total ram usage:        0 bytes
    97 ;; Hardware stack levels required when called:    1
    98 ;; This function calls:
    99 ;;		Nothing
   100 ;; This function is called by:
   101 ;;		Startup code after reset
   102 ;; This function uses a non-reentrant model
   103 ;;
   104                           
   105                           
   106                           ;psect for function _main
   107  0046                     _main:	
   108                           
   109                           ;int.c: 10: TRISA = 0x00;
   110                           
   111                           ;incstack = 0
   112                           ; Regs used in _main: [wreg+status,2]
   113  0046  1683               	bsf	3,5	;RP0=1, select bank1
   114  0047  0185               	clrf	5	;volatile
   115                           
   116                           ;int.c: 11: TRISB = 0xFF;
   117  0048  30FF               	movlw	255
   118  0049  0086               	movwf	6	;volatile
   119                           
   120                           ;int.c: 12: GIE = 1;
   121  004A  178B               	bsf	11,7	;volatile
   122                           
   123                           ;int.c: 13: INTE = 1;
   124  004B  160B               	bsf	11,4	;volatile
   125                           
   126                           ;int.c: 14: INTEDG = 1;
   127  004C  1701               	bsf	1,6	;volatile
   128                           
   129                           ;int.c: 16: PORTA = 0x00;
   130  004D  1283               	bcf	3,5	;RP0=0, select bank0
   131  004E  0185               	clrf	5	;volatile
   132  004F                     l19:	
   133                           ;int.c: 17: while(1)
   134                           
   135                           
   136                           ;int.c: 18: {
   137                           ;int.c: 19: PORTA = 0x06;
   138  004F  3006               	movlw	6
   139  0050  0085               	movwf	5	;volatile
   140  0051  284F               	goto	l19
   141  0052                     __end_of_main:	
   142                           
   143                           	psect	text1
   144  000E                     __ptext1:	
   145 ;; *************** function _handle_int *****************
   146 ;; Defined at:
   147 ;;		line 23 in file "int.c"
   148 ;; Parameters:    Size  Location     Type
   149 ;;		None
   150 ;; Auto vars:     Size  Location     Type
   151 ;;  i               2    5[BANK0 ] unsigned int 
   152 ;; Return value:  Size  Location     Type
   153 ;;                  1    wreg      void 
   154 ;; Registers used:
   155 ;;		wreg, status,2, status,0
   156 ;; Tracked objects:
   157 ;;		On entry : 0/0
   158 ;;		On exit  : 100/0
   159 ;;		Unchanged: 0/0
   160 ;; Data sizes:     COMMON   BANK0
   161 ;;      Params:         0       0
   162 ;;      Locals:         0       2
   163 ;;      Temps:          0       5
   164 ;;      Totals:         0       7
   165 ;;Total ram usage:        7 bytes
   166 ;; Hardware stack levels used:    1
   167 ;; This function calls:
   168 ;;		Nothing
   169 ;; This function is called by:
   170 ;;		Interrupt level 1
   171 ;; This function uses a non-reentrant model
   172 ;;
   173                           
   174                           
   175                           ;psect for function _handle_int
   176  000E                     _handle_int:	
   177                           
   178                           ;int.c: 25: unsigned int i = 0;
   179  000E  0191               	clrf	handle_int@i
   180  000F  0192               	clrf	handle_int@i+1
   181                           
   182                           ;int.c: 26: GIE = 0;
   183  0010  138B               	bcf	11,7	;volatile
   184                           
   185                           ;int.c: 27: if(INTF == 1)
   186  0011  188B               	btfsc	11,1	;volatile
   187  0012  2836               	goto	i1l547
   188  0013  283D               	goto	i1l25
   189  0014                     i1l539:	
   190                           
   191                           ;int.c: 30: {
   192                           ;int.c: 31: PORTA = 0x02;
   193  0014  3002               	movlw	2
   194  0015  0085               	movwf	5	;volatile
   195                           
   196                           ;int.c: 32: _delay((unsigned long)(((250U))*((4000000U)/4000.0)));
   197  0016  3002               	movlw	2
   198  0017  008E               	movwf	??_handle_int+2
   199  0018  3045               	movlw	69
   200  0019  008D               	movwf	??_handle_int+1
   201  001A  30A9               	movlw	169
   202  001B  008C               	movwf	??_handle_int
   203  001C                     u5_27:	
   204  001C  0B8C               	decfsz	??_handle_int,f
   205  001D  281C               	goto	u5_27
   206  001E  0B8D               	decfsz	??_handle_int+1,f
   207  001F  281C               	goto	u5_27
   208  0020  0B8E               	decfsz	??_handle_int+2,f
   209  0021  281C               	goto	u5_27
   210  0022  2823               	nop2
   211                           
   212                           ;int.c: 33: PORTA = 0x00;
   213  0023  1283               	bcf	3,5	;RP0=0, select bank0
   214  0024  0185               	clrf	5	;volatile
   215                           
   216                           ;int.c: 34: _delay((unsigned long)(((250U))*((4000000U)/4000.0)));
   217  0025  3002               	movlw	2
   218  0026  008E               	movwf	??_handle_int+2
   219  0027  3045               	movlw	69
   220  0028  008D               	movwf	??_handle_int+1
   221  0029  30A9               	movlw	169
   222  002A  008C               	movwf	??_handle_int
   223  002B                     u6_27:	
   224  002B  0B8C               	decfsz	??_handle_int,f
   225  002C  282B               	goto	u6_27
   226  002D  0B8D               	decfsz	??_handle_int+1,f
   227  002E  282B               	goto	u6_27
   228  002F  0B8E               	decfsz	??_handle_int+2,f
   229  0030  282B               	goto	u6_27
   230  0031  2832               	nop2
   231                           
   232                           ;int.c: 35: ++i;
   233  0032  1283               	bcf	3,5	;RP0=0, select bank0
   234  0033  0A91               	incf	handle_int@i,f
   235  0034  1903               	skipnz
   236  0035  0A92               	incf	handle_int@i+1,f
   237  0036                     i1l547:	
   238  0036  3000               	movlw	0
   239  0037  0212               	subwf	handle_int@i+1,w
   240  0038  3004               	movlw	4
   241  0039  1903               	skipnz
   242  003A  0211               	subwf	handle_int@i,w
   243  003B  1C03               	skipc
   244  003C  2814               	goto	i1l539
   245  003D                     i1l25:	
   246                           
   247                           ;int.c: 36: }
   248                           ;int.c: 38: }
   249                           ;int.c: 39: GIE = 1;
   250  003D  178B               	bsf	11,7	;volatile
   251                           
   252                           ;int.c: 40: INTF = 0;
   253  003E  108B               	bcf	11,1	;volatile
   254  003F  0810               	movf	??_handle_int+4,w
   255  0040  008A               	movwf	10
   256  0041  0E0F               	swapf	(??_handle_int+3)^0,w
   257  0042  0083               	movwf	3
   258  0043  0ECE               	swapf	78,f
   259  0044  0E4E               	swapf	78,w
   260  0045  0009               	retfie
   261  0046                     __end_of_handle_int:	
   262  004E                     btemp	set	78	;btemp
   263  004E                     wtemp	set	78
   264  004E                     wtemp0	set	78
   265  0050                     wtemp1	set	80
   266  0052                     wtemp2	set	82
   267  0054                     wtemp3	set	84
   268  0056                     wtemp4	set	86
   269  0058                     wtemp5	set	88
   270  004F                     wtemp6	set	79
   271  004E                     ttemp	set	78
   272  004E                     ttemp0	set	78
   273  0051                     ttemp1	set	81
   274  0054                     ttemp2	set	84
   275  0057                     ttemp3	set	87
   276  004F                     ttemp4	set	79
   277  004E                     ltemp	set	78
   278  004E                     ltemp0	set	78
   279  0052                     ltemp1	set	82
   280  0056                     ltemp2	set	86
   281  0050                     ltemp3	set	80
   282                           
   283                           	psect	intentry
   284  0004                     __pintentry:	
   285                           ;incstack = 0
   286                           ; Regs used in _handle_int: [wreg+status,2+status,0]
   287                           
   288  0004                     interrupt_function:	
   289  004E                     saved_w	set	btemp
   290  0004  00CE               	movwf	btemp
   291  0005  0E03               	swapf	3,w
   292  0006  1283               	bcf	3,5	;RP0=0, select bank0
   293  0007  008F               	movwf	??_handle_int+3
   294  0008  080A               	movf	10,w
   295  0009  0090               	movwf	??_handle_int+4
   296  000A  280E               	ljmp	_handle_int


Data Sizes:
    Strings     0
    Constant    0
    Data        0
    BSS         0
    Persistent  0
    Stack       0

Auto Spaces:
    Space          Size  Autos    Used
    COMMON            0      0       0
    BANK0            66      7       7

Pointer List with Targets:

    None.

Critical Paths under _main in COMMON

    None.

Critical Paths under _handle_int in COMMON

    None.

Critical Paths under _main in BANK0

    None.

Critical Paths under _handle_int in BANK0

    None.

Call Graph Tables:

 ---------------------------------------------------------------------------------
 (Depth) Function   	        Calls       Base Space   Used Autos Params    Refs
 ---------------------------------------------------------------------------------
 (0) _main                                                 0     0      0       0
 ---------------------------------------------------------------------------------
 Estimated maximum stack depth 0
 ---------------------------------------------------------------------------------
 (Depth) Function   	        Calls       Base Space   Used Autos Params    Refs
 ---------------------------------------------------------------------------------
 (1) _handle_int                                           7     7      0      24
                                              0 BANK0      7     7      0
 ---------------------------------------------------------------------------------
 Estimated maximum stack depth 1
 ---------------------------------------------------------------------------------

 Call Graph Graphs:

 _main (ROOT)

 _handle_int (ROOT)

 Address spaces:
Name               Size   Autos  Total    Cost      Usage
BITCOMMON            0      0       0       0        0.0%
EEDATA              40      0       0       0        0.0%
NULL                 0      0       0       0        0.0%
CODE                 0      0       0       0        0.0%
BITSFR0              0      0       0       1        0.0%
SFR0                 0      0       0       1        0.0%
COMMON               0      0       0       1        0.0%
BITSFR1              0      0       0       2        0.0%
SFR1                 0      0       0       2        0.0%
STACK                0      0       0       2        0.0%
BANK0               42      7       7       3       10.6%
ABS                  0      0       0       4        0.0%
BITBANK0            42      0       0       5        0.0%
DATA                 0      0       0       6        0.0%


Microchip Technology PIC Macro Assembler V1.37 build -260352376 
Symbol Table                                                                                   Sat Apr 16 17:33:37 2016

                     l19 004F                      _GIE 005F                     _INTE 005C  
                   _INTF 0059                     i1l25 003D                     u5_27 001C  
                   u6_27 002B                     _main 0046                     btemp 004E  
                   ltemp 004E                     start 000B                     ttemp 004E  
                   wtemp 004E                    ?_main 000C                    i1l539 0014  
                  i1l547 0036                    _PORTA 0005                    _TRISA 0085  
                  _TRISB 0086                    pclath 000A                    ltemp0 004E  
                  ltemp1 0052                    ltemp2 0056                    ltemp3 0050  
                  ttemp0 004E                    ttemp1 0051                    ttemp2 0054  
                  ttemp3 0057                    ttemp4 004F                    status 0003  
                  wtemp0 004E                    wtemp1 0050                    wtemp2 0052  
                  wtemp3 0054                    wtemp4 0056                    wtemp5 0058  
                  wtemp6 004F          __initialization 000C             __end_of_main 0052  
                 ??_main 0000                   _INTEDG 040E                   saved_w 004E  
__end_of__initialization 000C           __pcstackCOMMON 0000               __pmaintext 0046  
             __pintentry 0004               _handle_int 000E                  __ptext1 000E  
   end_of_initialization 000C              ?_handle_int 000C      start_initialization 000C  
    __size_of_handle_int 0038                ___latbits 0000            __pcstackBANK0 000C  
      interrupt_function 0004             ??_handle_int 000C       __end_of_handle_int 0046  
          __size_of_main 000C                 intlevel1 0000              handle_int@i 0011  

Perdonate l'eventuale formattazione schifosa....se conoscete un programma simile ad astyle per l'assembly fatemelo sapere.
Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.
ACM/IEEE Code of ethics.
Avatar utente
steff
Moderatore Globale
Moderatore Globale
Messaggi: 40351
Iscrizione: domenica 18 febbraio 2007, 19:48
Desktop: LXQt+labwc
Distribuzione: Arch; Debian; Ubuntu Server
Sesso: Maschile
Località: Toscana
Contatti:

Re: [C][ASM] Programmazione PIC 16F84A

Messaggio da steff »

Chiusa su richiesta dell'autore, perché troppo generica.
Hai fatto un backup oggi? Ieri?? Quando???
La Documentazione da consultare e la FAQ sul uso del forum
Sistemi: LXQt - semplice, modulare e configurabile + *ubuntu in Vbox
Scrivi risposta

Ritorna a “Quarantena”

Chi c’è in linea

Visualizzano questa sezione: 0 utenti iscritti e 1 ospite