PRÁTICA 1 – PIC ASSEMBLY BLINK
Objetivos:
- Apresentação programa MPLAB.
- Mostrar pinagem do PIC.
Introdução:
Pinagem do processador PIC 16F628A:
Tarefa:
- Compilar o programa 1 (abaixo) em ASSEMBLY usando o MPLAB.
- Gravar o PIC usando o gravador
- Montar o circuito e verificar o funcionamento.
Programa 1 – Blink em RA0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
list P = 16F628A include P16F628A.inc ; CONFIG __CONFIG _INTOSC_OSC_NOCLKOUT &_WDT_OFF & _PWRTE_ON & _BOREN_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF org 0x0000 START MOVLW 0x07 MOVWF CMCON BSF STATUS,RP0 MOVLW 0x00 MOVWF TRISA MOVLW 0x00 MOVWF TRISB BCF STATUS,RP0 INICIO BSF PORTA, 0 CALL DELAY BCF PORTA, 0 CALL DELAY GOTO INICIO DELAY MOVLW 0XFF MOVWF 0X20 VSET MOVLW 0XFF MOVWF 0X21 LOOP DECFSZ 0X21 GOTO LOOP DECFSZ 0X20 GOTO VSET RETURN END |
Circuito 1 – BLINK
Desafio: Tente aumentar o delay para 1s.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
list P = 16F628A include P16F628A.inc ; CONFIG __CONFIG _INTOSC_OSC_NOCLKOUT &_WDT_OFF & _PWRTE_ON & _BOREN_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF org 0x0000 START MOVLW 0x07 MOVWF CMCON BSF STATUS,RP0 MOVLW 0x00 MOVWF TRISA MOVLW 0x00 MOVWF TRISB BCF STATUS,RP0 INICIO BSF PORTA, 0 CALL DELAY CALL DELAY CALL DELAY CALL DELAY CALL DELAY BCF PORTA, 0 CALL DELAY CALL DELAY CALL DELAY CALL DELAY CALL DELAY GOTO INICIO DELAY MOVLW 0XFF MOVWF 0X20 VSET MOVLW 0XFF MOVWF 0X21 LOOP DECFSZ 0X21 GOTO LOOP DECFSZ 0X20 GOTO VSET RETURN END |