TODOPIC

Microcontroladores PIC => Primeros pasos - Iniciación a los microcontroladores => Mensaje iniciado por: estebin3d en 15 de Octubre de 2007, 13:29:25

Título: MPLAB marca error al compilar.
Publicado por: estebin3d en 15 de Octubre de 2007, 13:29:25
Hola gente del foro!

El problema me surge al intentar compilar un programa simple hecho para el pic 12F508, pero muestra que no conoce los términos "GPIO" y "TRISIO". Quizás haya que realizar alguna configuración en el compilador, no lo sé. Si alguien conoce del tema le agradecería la ayuda. Adjunto el programa. Gracias de antemano.
Esteban.

Código: ASM
  1. list      p=12f508      ; list directive to define processor
  2.    #include   ; include device specific header file
  3.    errorlevel  -302, -207  ; suppress useless assembler warnings
  4.  
  5.    __CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _IntRC_OSC
  6.  
  7.   CLRF GPIO           ; GPIO.1 LED drive output OFF
  8.   MOVLW b'11111101'   ; GPIO,0 = IR data in, GPIO,1 = IR data out
  9.   TRISIO              ; All inputs except GPIO.1
  10.  
  11. ; If input GPIO.0=1 output 40KHz on GPIO.1
  12. ; If input GPIO.0=0 turn OFF carrier on GPIO.1
  13.  
  14. HOLD40            ; Generates 40KHz carrier based on logic input
  15.    BCF   GPIO,1   ; LED = OFF
  16.    BTFSS GPIO,0   ; Logic 1 turns ON carrier
  17.    GOTO  $-1      ; Logic 0 turns OFF carrier
  18. FREQ1
  19.    BSF    GPIO,1   ;1uS LED = ON here
  20.    BTFSS  GPIO,0   ;2uS
  21.    GOTO   HOLD40   ;3uS
  22.    BTFSS  GPIO,0   ;4uS 2uS instruction if bit = 1
  23.    GOTO   HOLD40   ;5uS NOP inserted here if bit = 0
  24.    BTFSS  GPIO,0   ;6uS
  25.    GOTO   HOLD40   ;7uS
  26.    BTFSS  GPIO,0   ;8uS
  27.    GOTO   HOLD40   ;9uS
  28.    BTFSS  GPIO,0   ;10uS
  29.    GOTO   HOLD40   ;11uS
  30.    BTFSS  GPIO,0   ;12uS
  31.    GOTO   HOLD40   ;13uS
  32.    BCF    GPIO,1   ;14uS LED = OFF here
  33.    BTFSS  GPIO,0   ;15uS
  34.    GOTO   HOLD40   ;16uS
  35.    BTFSS  GPIO,0   ;17uS
  36.    GOTO   HOLD40   ;18uS
  37.    BTFSS  GPIO,0   ;19uS
  38.    GOTO   HOLD40   ;20uS
  39.    BTFSS  GPIO,0   ;21uS
  40.    GOTO   HOLD40   ;22uS
  41.    BTFSC  GPIO,0   ;23uS
  42.    GOTO   FREQ1    ;25uS, GOTO requires 2uS, 25uS total=40KHz
  43.    BCF    GPIO,1   ;else LED = OFF
  44.    GOTO   HOLD40   ;return to monitor input pin
  45.  
  46.    END
Título: Re: MPLAB marca error al compilar.
Publicado por: micro_cadaver en 15 de Octubre de 2007, 16:28:59
te falta el include:

  #include   ; include device specific header file
;ESTA MAL

#include <p12f508.inc> ; include device specific header file
;OK
Título: Re: MPLAB marca error al compilar.
Publicado por: estebin3d en 16 de Octubre de 2007, 01:21:23
Funcionó!!!!!
Muchas gracias micro_cadaver, salió ok. Que haría sin ustedes  :-/
Título: Re: MPLAB marca error al compilar.
Publicado por: micro_cadaver en 16 de Octubre de 2007, 13:58:26
bien por ti!  :-/