Autor Tema: Ejemplos en Asembler PIC16F84A  (Leído 231954 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado gnivre

  • PIC10
  • *
  • Mensajes: 3
Ejemplos en Asembler PIC16F84A
« Respuesta #60 en: 16 de Diciembre de 2013, 01:32:03 »
buenas noches a todos, soy prácticamente nuevo y estoy aqui para solicitar les su ayuda con un trabajo de la escuela...... tengo un problema con un codigo de una matris de 7x45 pasa mensajes que consegui googleando, el detalle es que al emularlo con proteus anda de maravilla pero ahora quiero cambiarle el mensaje pero cuando quiero editar el codigo y trato de compilar el mplab me dice BUILD FAILED y de ahi no puedo pasar......este el el codigo....ocupo que el mensaje sea BIENVENIDOS A LA BIBLIOTECA  DEL INSTITUTO TECNOLOGUICO.

Start     ORG 0x00             ;This sets up the ports 
          BSF    03,5
          MOVLW 00h
          MOVWF 05h
          MOVWF 06h
          BCF    03,5
          ;org   04h         
          GOTO    Run1

              ;Table1  holds the hex values for each column of LEDs


Table1       ADDWF    02h,1            ;Add W to Program Counter

      RETLW    .00  ;                     
                RETLW    7fh  ;
                RETLW    49h ;
                RETLW    49h  ;          ;B
                retlw   49h
                retlw   36h

      RETLW    .00  ;
                RETLW    .65  ;
                RETLW    .127  ;   
                RETLW    .65  ;            ;I
                ;RETLW   .64  ;
                ;RETLW    .63  ;

      retlw   .00
      retlw   7fh
      retlw   49h            ;E
      retlw   49h
      retlw   41h

      retlw   .00
      retlw   7fh
      retlw   04h
      retlw   08h            ;N
      retlw   10h
      retlw   7fh

      

      retlw   .00
      retlw   .31
      retlw   .32          ;V
      retlw   .64
      retlw   .32
      retlw   .31

      retlw   .00
      retlw   7fh
      retlw   49h            ;E
      retlw   49h
      retlw   41h

      retlw   .00
      retlw   7fh
      retlw   04h
      retlw   08h            ;N
      retlw   10h
      retlw   7fh

      RETLW    .00   
                RETLW    .65 
                RETLW    .127     
                RETLW    .65              ;I

      retlw   .00
      retlw   .127
      retlw   .65
      retlw   .65              ;D
      retlw   .65
      retlw   .62

      retlw   .00
      retlw   3eh
      retlw   41h
      retlw   41h                ;O
      retlw   41h
      retlw   3eh

                RETLW    .00 
                RETLW    26h
                RETLW    49h   
               RETLW    49h               ;S
                RETLW    49h   
                RETLW    32h
      
      retlw   .00
      retlw   .00

      retlw   .00
      retlw   7eh
      retlw   09h
      retlw   09h             ;A
      retlw   09h
      retlw   7eh

      retlw   .00
      retlw   .00

                retlw   .00
      retlw   .127
      retlw   .64            ;L
      retlw   .64
      retlw   .64
      retlw   .64
               
                retlw   .00
      retlw   7eh
      retlw   09h
      retlw   09h             ;A
      retlw   09h
      retlw   7eh

                retlw   .00
      retlw   .00
               
      RETLW    .00  ;                     
                RETLW    7fh  ;
                RETLW    49h ;
                RETLW    49h  ;          ;B
                retlw   49h
                retlw   36h

      RETLW    .00  ;
                RETLW    .65  ;
                RETLW    .127  ;   
                RETLW    .65  ;            ;I
                ;RETLW   .64  ;
                ;RETLW    .63  ;

                RETLW    .00  ;                     
                RETLW    7fh  ;
                RETLW    49h ;
                RETLW    49h  ;          ;B
                retlw   49h
                retlw   36h


                retlw   .00
      retlw   .127
      retlw   .64            ;L
      retlw   .64
      retlw   .64
      retlw   .64


      RETLW    .00  ;
                RETLW    .65  ;
                RETLW    .127  ;   
                RETLW    .65  ;            ;I
                ;RETLW   .64  ;
                ;RETLW    .63  ;

                retlw   .00
      retlw   3eh
      retlw   41h
      retlw   41h                ;O
      retlw   41h
      retlw   3eh


                retlw .00
                retlw 49h
                retlw 43h
                retlw 43h            ;T
                retlw 43h
                retlw 43h

                 
                retlw   .00
      retlw   7fh
      retlw   49h            ;E
      retlw   49h
      retlw   41h   

                retlw   .00
                retlw   3eh
      retlw   41h
      retlw   41h           ;C
      retlw   41h
      retlw   22h

                retlw   .00
      retlw   7eh
      retlw   09h
      retlw   09h             ;A
      retlw   09h
      retlw   7eh



                retlw   .00
      retlw   .00
                retlw   .00
      retlw   .00
                retlw   .00
      retlw   .00
                retlw   .00
      retlw   .00
                retlw   .00
      retlw   .00
                retlw   .00
      retlw   .00
                retlw   .00
      retlw   .00
                retlw   .00
      retlw   .00


                retlw   .00
                retlw   3eh
      retlw   41h
      retlw   41h           ;C
      retlw   41h
      retlw   22h

                retlw   .00
      retlw   3eh
      retlw   41h
      retlw   41h                ;O
      retlw   41h
      retlw   3eh

                retlw   .00
      retlw   7fh
      retlw   04h
      retlw   08h            ;N
      retlw   10h
      retlw   7fh

                RETLW    .00 
                RETLW    26h
                RETLW    49h   
               RETLW    49h               ;S
                RETLW    49h   
                RETLW    32h

                RETLW    .00  ;  "E"
                RETLW    3fh ;0000000
                RETLW    40h  ;0  0  0
                RETLW    40h  ;0  0  0         ;U
                RETLW    40h
                retlw   3fh  ;0     0

                retlw   .00
      retlw   .127
      retlw   .64            ;L
      retlw   .64
      retlw   .64
      retlw   .64

               
                retlw .00
                retlw 49h
                retlw 43h
                retlw 43h            ;T
                retlw 43h
                retlw 43h

               
                retlw   .00
      retlw   7eh
      retlw   09h
      retlw   09h             ;A
      retlw   09h
      retlw   7eh

               
      retlw   .00
      retlw   .00

                retlw   .00
      retlw   .127
      retlw   .65
      retlw   .65              ;D
      retlw   .65
      retlw   .62

                retlw   .00
      retlw   7fh
      retlw   49h            ;E
      retlw   49h
      retlw   41h

                retlw   .00
      retlw   .00 

                retlw   .00
      retlw   .127
      retlw   .64            ;L
      retlw   .64
      retlw   .64

                RETLW    .00  ;
                RETLW    .65  ;
                RETLW    .127  ;   
                RETLW    .65  ;            ;I
                ;RETLW   .64  ;
                ;RETLW    .63  ;

                RETLW    .00  ;                     
                RETLW    7fh  ;
                RETLW    49h ;
                RETLW    49h  ;          ;B
                retlw   49h
                retlw   36h

                retlw   .00
      retlw   .127
      retlw   .17          ;R
      retlw   .17
      retlw   .17
      retlw   .110

                retlw   .00
      retlw   3eh
      retlw   41h
      retlw   41h                ;O
      retlw   41h
      retlw   3eh

                RETLW    .00 
                RETLW    26h
                RETLW    49h   
               RETLW    49h               ;S
                RETLW    49h   
                RETLW    32h








         
               

      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h
      retlw      00h






   
      retlw   .255




Run1            CLRF 11h           ;Clear the Ghost locations ready for starting
                CLRF 12h
                CLRF 13h
                CLRF 14h
                CLRF 15h
      clrf 26h
      clrf 27h
      clrf 28h
      clrf 29h

      clrf 2Ah
      CLRF 2Bh           ;Clear the Ghost locations ready for starting
                CLRF 2Ch
                CLRF 2Dh
                CLRF 2Eh
                CLRF 2Fh
      clrf 30h
      clrf 31h
      clrf 32h

      clrf 33h
      clrf 34h
                CLRF 35h           ;Clear the Ghost locations ready for starting
                CLRF 36h
                CLRF 37h
                CLRF 38h
                CLRF 39h
      clrf 3Ah
      clrf 3Bh

      clrf 3Ch
      clrf 3Dh
      clrf 3Eh        ;Clear the Ghost locations ready for starting
       
      MOVLW 00
                MOVWF 19h      ;File 19h is the jump value for table
run2            MOVLW 02h
                MOVWF 18h      ;File 18h counts the number of scans
                  CALL Shift         ; and controls the "run speed"
                  INCF 19h,1
                  MOVF 19h,0      ;Put jump value into W
             CALL Table1
             MOVWF 3Eh      ;W contains table data - put it in 15h
                  XORLW 0FFh     ;If table value is FF,
                  BTFSC 03,2        ; bit 2 of file 3 will be SET (=1)
                  GOTO Run1       ;Start Table1 again
Run3        DECFSZ 18h,1    ;Scan the display 40h times
                 GOTO Run4
                 GOTO Run2
Run4        CALL Scan
                 GOTO Run3

Scan           
      BSF 05,1               ;Reset 4017
                NOP
                BCF 05,1

      call DelD       ;
               MOVF 11h,0           ;Output the data at the 5 Ghost
               MOVWF 06h        ;1   ; locations to the display
               CALL DelD   ;
               MOVF 12h,0
               MOVWF 06h   ;2
               CALL DelD   ;
               MOVF 13h,0
               MOVWF 06h        ;3
               CALL DelD   ;
               MOVF 14h,0
               MOVWF 06h       ;4
               CALL DelD   ;
               MOVF 15h,0
               MOVWF 06h       ;5
               CALL DelD   ;
      MOVF 26h,0           ;Output the data at the 5 Ghost
               MOVWF 06h       ;6    ; locations to the display
               CALL DelD   ;
               MOVF 27h,0
               MOVWF 06h        ;7   
               CALL DelD   ;
               MOVF 28h,0
               MOVWF 06h       ;8
               CALL DelD   ;
                MOVF 29h,0
               MOVWF 06h       ;9
               CALL DelD-0
               
               ;
      
               
      BSF 05,1               ;Reset 4017
                NOP
                BCF 05,1

                call DelD_2
                MOVF 2Ah,0
               MOVWF 06h
               CALL DelD_2   ; 1
                movf 2Bh,0
      movwf 06h
      call DelD_2     ; 2
      movf 2Ch,0
      movwf 06h
      call DelD_2     ; 3
                movf 2Dh,0
      movwf 06h
      call DelD_2     ; 4
      movf 2Eh,0
      movwf 06h
      call DelD_2     ; 5
                movf 2Fh,0
      movwf 06h
      call DelD_2     ; 6
      movf 30h,0
      movwf 06h
      call DelD_2     ; 7
                movf 31h,0
      movwf 06h
      call DelD_2     ; 8
                movf 32h,0
      movwf 06h
      call DelD_2     ; 9

                     
                BSF 05,1               ;Reset 4017
                NOP
                BCF 05,1

                call DelD_3      ;
                movf 33h,0
                movwf 06h
      call DelD_3    ; 1
      movf 34h,0
      movwf 06h
      call DelD_3     ; 2
                movf 35h,0
      movwf 06h
      call DelD_3    ; 3
      movf 36h,0
      movwf 06h
      call DelD_3     ; 4
                movf 37h,0
      movwf 06h
      call DelD_3    ; 5
      movf 38h,0
      movwf 06h
      call DelD_3     ; 6
                movf 39h,0
      movwf 06h
      call DelD_3    ; 7
      movf 3Ah,0
      movwf 06h
      call DelD_3     ; 8
                movf 3Bh,0
      movwf 06h
      call DelD_3     ; 9

                BSF 05,1               ;Reset 4017
                NOP
                BCF 05,1

                call DelD_4      ;
                movf 3Ch,0
                movwf 06h
      call DelD_4    ; 1
      movf 3Dh,0
      movwf 06h
      call DelD_4     ; 2
                movf 3Eh,0
      movwf 06h
      call DelD_4    ; 3



                RETURN
 
       ;SHIFT moves the data one place to the left to give the "movement"
       ;  effect on the screen

Shift          MOVF 12h,0         ;Move file 12h to W
               MOVWF 11h         ;Move W to file 11h
               MOVF 13h,0         ;Move file 13h to W
               MOVWF 12h         ;Move W to file 12h
               MOVF 14h,0         ;Move file 14h to W
               MOVWF 13h         ;Move W to file 13h
               MOVF 15h,0         ;Move file 15h to W
               MOVWF 14h         ;Move W to file 14h
      movf 26h,0
      movwf 15h
      movf 27h,0
      movwf 26h
      movf 28h,0
      movwf 27h
      movf 29h,0
      movwf 28h
      movf 2Ah,0
                movwf 29h

      movf 2Bh,0
      movwf 2Ah
                MOVF 2Ch,0         ;Move file 12h to W
               MOVWF 2Bh         ;Move W to file 11h
               MOVF 2Dh,0         ;Move file 13h to W
               MOVWF 2Ch         ;Move W to file 12h
               MOVF 2Eh,0         ;Move file 14h to W
               MOVWF 2Dh         ;Move W to file 13h
               MOVF 2Fh,0         ;Move file 15h to W
               MOVWF 2Eh         ;Move W to file 14h
      movf 30h,0
      movwf 2Fh
      movf 31h,0
      movwf 30h
      movf 32h,0
      movwf 31h
           movf 33h,0
      movwf 32h

      movf 34h,0
      movwf 33h
                MOVF 35h,0         ;Move file 12h to W
               MOVWF 34h         ;Move W to file 11h
               MOVF 36h,0         ;Move file 13h to W
               MOVWF 35h         ;Move W to file 12h
               MOVF 37h,0         ;Move file 14h to W
               MOVWF 36h         ;Move W to file 13h
               MOVF 38h,0         ;Move file 15h to W
               MOVWF 37h         ;Move W to file 14h
      movf 39h,0
      movwf 38h
      movf 3Ah,0
      movwf 39h
      movf 3Bh,0
      movwf 3Ah
      movf 3Ch,0
      movwf 3Bh

      movf 3Dh,0
      movwf 3Ch
                movf 3Eh,0
      movwf 3Dh
                RETURN

   
   
DelD       movlw .128
           movwf 1Bh
DelD1      DECFSZ 1Bh,1      ;Delay for viewing the
           GOTO DelD1            ; column of LEDs
           
           clrf 06h
clk        bsf 05,0
           nop                       ; the next output
           BCF 05,0
      return

      
DelD_2     movlw .128
           movwf 1Bh
DelD2      DECFSZ 1Bh,1      ;Delay for viewing the
           GOTO DelD2            ; column of LEDs
           
           clrf 06h
clk2       bsf 05,2
           nop                       ; the next output
           BCF 05,2
           return


DelD_3     movlw .128
           movwf 1Bh     
DelD3      DECFSZ 1Bh,1      ;Delay for viewing the
           GOTO DelD3            ; column of LEDs
           
           clrf 06h
clk3       bsf 05,3
           nop                       ; the next output
           BCF 05,3
           RETURN

DelD_4     movlw .128
           movwf 1Bh
DelD4      DECFSZ 1Bh,1      ;Delay for viewing the
           GOTO DelD4            ; column of LEDs
           
           clrf 06h
clk4       bsf 06,7
           nop                       ; the next output
           BCF 06,7
           RETURN


           
           END

Desconectado BrunoF

  • Administrador
  • DsPIC30
  • *******
  • Mensajes: 3865
Re: Ejemplos en Asembler PIC16F84A
« Respuesta #61 en: 16 de Diciembre de 2013, 10:03:42 »
Hola.

Bienvenido al foro. Deberías decirnos al menos qué error te da, aunque si ese es todo el código, de entrada te falta la declaración del micro y los fuses, mínimamente.

Por otro lado, Tabla1 es demasiada larga y excede el tamaño de paginación de la ROM de ese uC. Te recomiendo que primero logres compilar el código original sin modificar el mensaje. Una vez que logres compilar eso, podés intentar hacerle cambios personalizados.

Saludos.
"All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value."  -- Carl Sagan

Sólo responderé a mensajes personales, por asuntos personales. El resto de las consultas DEBEN ser escritas en el foro público. Gracias.

Desconectado gnivre

  • PIC10
  • *
  • Mensajes: 3
Re: Ejemplos en Asembler PIC16F84A
« Respuesta #62 en: 16 de Diciembre de 2013, 11:16:23 »
pues ese es el codigo original  :( y en el proteus usa el 16f84a  :( ....... el error es el sig.
pende en utilizar un 16f887 pero necesito que diga otro mensaje ayuda porfavor :) :mrgreen:

Código: [Seleccionar]

----------------------------------------------------------------------
Debug build of project `C:\Nueva carpeta\listo.mcp' started.
Language tool versions: MPASMWIN.exe v5.37, mplink.exe v4.37, mplib.exe v4.37
Preprocessor symbol `__DEBUG' is defined.
Sun Dec 15 22:27:31 2013
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p18F452 "listo.asm" /l"listo.lst" /e"listo.err" /o"listo.o" /d__DEBUG=1
Message[301] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F887.INC 33 : MESSAGE: (Processor-header file mismatch.  Verify selected processor.)
Error[113]   C:\NUEVA CARPETA\LISTO.ASM 435 : Symbol not previously defined (Run2)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Nueva carpeta\listo.mcp' failed.
Language tool versions: MPASMWIN.exe v5.37, mplink.exe v4.37, mplib.exe v4.37
Preprocessor symbol `__DEBUG' is defined.
Sun Dec 15 22:27:32 2013
----------------------------------------------------------------------
BUILD FAILED


Desconectado gnivre

  • PIC10
  • *
  • Mensajes: 3
Re: Ejemplos en Asembler PIC16F84A
« Respuesta #63 en: 16 de Diciembre de 2013, 11:52:29 »
estos son los archivos originales que conseguí...... por favor si no es tanta la molestia y tienes un momento libre puedes darles un vistazo y ayudarme con mi trabajo final de la uni  :-/

https://mega.co.nz/#!eJdiGITS!NABTuGR5Aae8uWPFrJGn_FhFvX10nIk7p7gRPey8Pkg

   

Desconectado tapi8

  • Colaborador
  • PIC24H
  • *****
  • Mensajes: 1506
Re: Ejemplos en Asembler PIC16F84A
« Respuesta #64 en: 18 de Diciembre de 2013, 07:41:01 »
El unico error que te da es este:

Error[113]   C:\NUEVA CARPETA\LISTO.ASM 435 : Symbol not previously defined (Run2)

Si haces doble cilck sobre ese error te llevara a la linea de codigo donde esta, te dice que no has definido esa variable "Run2"

Aparte de esa tabla que como te dice BrunoF es muy larga, si lo estas migrando de un 16f84 a un 16f887, debes poner los puertos A y B como digitales:

BANKSEL  ANSEL
clrf   ANSEL      ; PORTA I/O digitales
clrf   ANSELH      ; PORTB I/O digitales

Desconectado BrunoF

  • Administrador
  • DsPIC30
  • *******
  • Mensajes: 3865
Re: Ejemplos en Asembler PIC16F84A
« Respuesta #65 en: 18 de Diciembre de 2013, 13:50:02 »
El unico error que te da es este:

Error[113]   C:\NUEVA CARPETA\LISTO.ASM 435 : Symbol not previously defined (Run2)

Si haces doble cilck sobre ese error te llevara a la linea de codigo donde esta, te dice que no has definido esa variable "Run2"

Aparte de esa tabla que como te dice BrunoF es muy larga, si lo estas migrando de un 16f84 a un 16f887, debes poner los puertos A y B como digitales:

BANKSEL  ANSEL
clrf   ANSEL      ; PORTA I/O digitales
clrf   ANSELH      ; PORTB I/O digitales

No solo eso. Ese programa tiene un diseño fatal. Utiliza directamente las  posiciones de memoria, no utilizando  labels para referirse a ellas.
Está lleno de cosas como:

MOVF 12h,0         ;Move file 12h to W
               MOVWF 11h         ;Move W to file 11h
               MOVF 13h,0         ;Move file 13h to W
               MOVWF 12h         ;Move W to file 12h
               MOVF 14h,0         ;Move file 14h to W
               MOVWF 13h         ;Move W to file 13h
               MOVF 15h,0         ;Move file 15h to W
               MOVWF 14h         ;Move W to file 14h

Que apunta a direcciones no validas como GPR(general purpose RAM) en el 16F877 y hay que modificar todas a mano. Bastante tedioso y propenso a cometer errores.
"All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value."  -- Carl Sagan

Sólo responderé a mensajes personales, por asuntos personales. El resto de las consultas DEBEN ser escritas en el foro público. Gracias.

Desconectado tapi8

  • Colaborador
  • PIC24H
  • *****
  • Mensajes: 1506
Re: Ejemplos en Asembler PIC16F84A
« Respuesta #66 en: 18 de Diciembre de 2013, 15:52:41 »
Si Bruno en eso ya me fije asi por encima, yo decia que era el unico error al compilar.

De hecho el programa ya ni me meti a analizarlo porque tiene que ser muy tedioso.

Le dije lo de definir los puertos como digitales para migrarlo de 16f84 al 16f887 porque es imprescindible.

Citar
MOVF 12h,0         ;Move file 12h to W
               MOVWF 11h         ;Move W to file 11h
               MOVF 13h,0         ;Move file 13h to W
               MOVWF 12h         ;Move W to file 12h
               MOVF 14h,0         ;Move file 14h to W
               MOVWF 13h         ;Move W to file 13h
               MOVF 15h,0         ;Move file 15h to W
               MOVWF 14h         ;Move W to file 14h

Que apunta a direcciones no validas como GPR(general purpose RAM) en el 16F877 y hay que modificar todas a mano. Bastante tedioso y propenso a cometer errores.

 En esto de las direcciones ni me habia fijado, pero tambien tambien tienes razon, estan hechas para el f84 y hay que cambiarlas todas.

Amigo gnivre te vale mas ponerte con paciencia y hacerte uno desde 0.

Desconectado Aztaroth

  • PIC10
  • *
  • Mensajes: 1
Re: Ejemplos en Asembler PIC16F84A
« Respuesta #67 en: 19 de Mayo de 2015, 04:31:55 »
pues a mi me gustaria tener las simulaciones en proteus del ejemplo 8 y 9 pero los enlaces están malos, o mas bien los archivos están corruptos o algo por el estilo, ya que los descargo pero no se abren con winrar ni winzip.

saludos.
es verdad estoy viendo la instruccion COMF y este ejemplo me sirvio, pero no pude ver su simulacion, como voy empezando es algo dificil quisiera saber si pudiste conseguir la simulacion en proteus, ojala puedan ayudarme Gracias.  :(

Desconectado KILLERJC

  • Colaborador
  • DsPIC33
  • *****
  • Mensajes: 8242
Re: Ejemplos en Asembler PIC16F84A
« Respuesta #68 en: 19 de Mayo de 2015, 11:28:43 »
Ninguna instruccion tiene mucho secreto, la instruccion COMF simplemente nega el valor de un registro y luego lo almacena en W o en el mismo registro

Si supones que el registro se llama REG1

MOVLW 0x87 ; 1000 0111
MOVWF REG1 ; REG1 = 0x87
Podria hacer:
COMF  REG1,W   ;  W = 0x78 = 0111 1000
o
COMF  REG1,F    ; REG1 = 0x78 = 0111 1000

Desconectado kenya Solorzano

  • PIC10
  • *
  • Mensajes: 1
Re: Ejemplos en Asembler
« Respuesta #69 en: 03 de Julio de 2015, 18:29:39 »
Aqui va el ejemplo 01:

Prender un led con un 16F84A por RB0, de lo mas sencillo


Código: ASM
  1. ;       02-06-06
  2. ;       Ejemplo 01
  3. ;       Prender un led
  4. ;       PIC 16f84a
  5. ;       MPLAB 7.30
  6. ;       PROTEUS 6.9 SP3
  7. ;       Veguepic
  8.  
  9.         LIST    P=16F84A,                               ; usar PIC 16F84A
  10.         #include <p16f84A.inc>
  11.  
  12.         __CONFIG _CP_OFF&_PWRTE_ON&_WDT_OFF&_XT_OSC     ; code protec           off
  13.                                                         ; power up timer        on
  14.                                                         ; watchdog              off
  15.                                                         ; osc                   XT
  16.  
  17.         ORG     0
  18.         BSF     STATUS,5                                ; activa la pagina 1
  19.         MOVLW   B'00000'                                ; carga 00000 en W
  20.         MOVWF   TRISA                                   ; puerto a todos salidas
  21.         MOVLW   B'00000000'                             ; carga 00000000 en W
  22.         MOVWF   TRISB                                   ; puerto b todos salidaS
  23.         BCF     STATUS,5                                ; volvemos a la pagina 0
  24.  
  25.         BCF     PORTB,0                                 ; ponemos a 0 RB0
  26.         BCF     PORTB,1                                 ; ponemos a 0 RB1
  27.         BCF     PORTB,2                                 ; ponemos a 0 RB2
  28.         BCF     PORTB,3                                 ; ponemos a 0 RB3
  29.         BCF     PORTB,4                                 ; ponemos a 0 RB4
  30.         BCF     PORTB,5                                 ; ponemos a 0 RB5
  31.         BCF     PORTB,6                                 ; ponemos a 0 RB6
  32.         BCF     PORTB,7                                 ; ponemos a 0 RB7
  33.  
  34.                                                         ; luego haremos todos juntos
  35.  
  36. INICIO                                                  ; etiqueta
  37.         BSF     PORTB,0                                 ; pone a 1 RB0
  38.         GOTO    INICIO                                  ; va a inicio
  39.  
  40.         END                                             ; fin de programa


 

anything