Autor Tema: Problema al compilar un ejemplo de Microchip  (Leído 484 veces)

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

Conectado Falkenauges01

  • PIC10
  • *
  • Mensajes: 8
Problema al compilar un ejemplo de Microchip
« en: 31 de Mayo de 2023, 23:45:43 »
Buenas que tal, trataba de compilar un ejemplo de código de Microchip específicamente el de la nota AN700 sobre un convertidor Delta-Sigma utilizando un comparador analógico, sin embargo, cuando lo copio a MPLAB no se ensambla, la verdad no se a que se deba aun soy principiante en ensamblador, aqui los errores:


Error[152]   \DELTASIGMAADC\DELTASIG.ASM 11 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 12 : Executable code and data must be defined in an appropriate section
Message[302] \DELTASIGMAADC\DELTASIG.ASM 13 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 13 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 14 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 15 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 16 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 17 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 18 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 21 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 22 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 23 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 24 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 25 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 26 : Executable code and data must be defined in an appropriate section
Error[150]   \DELTASIGMAADC\DELTASIG.ASM 27 : Labels must be defined in a code or data section when making an object file
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 28 : Executable code and data must be defined in an appropriate section
Error[151]   \DELTASIGMAADC\DELTASIG.ASM 29 : Operand contains unresolvable labels or is too complex
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 29 : Executable code and data must be defined in an appropriate section
Error[150]   \DELTASIGMAADC\DELTASIG.ASM 30 : Labels must be defined in a code or data section when making an object file
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 31 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 32 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 33 : Executable code and data must be defined in an appropriate section
Error[151]   \DELTASIGMAADC\DELTASIG.ASM 34 : Operand contains unresolvable labels or is too complex
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 34 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 35 : Executable code and data must be defined in an appropriate section
Error[151]   \DELTASIGMAADC\DELTASIG.ASM 36 : Operand contains unresolvable labels or is too complex
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 36 : Executable code and data must be defined in an appropriate section
Error[150]   \DELTASIGMAADC\DELTASIG.ASM 37 : Labels must be defined in a code or data section when making an object file
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 38 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 39 : Executable code and data must be defined in an appropriate section
Error[151]   \DELTASIGMAADC\DELTASIG.ASM 40 : Operand contains unresolvable labels or is too complex
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 40 : Executable code and data must be defined in an appropriate section
Error[150]   \DELTASIGMAADC\DELTASIG.ASM 41 : Labels must be defined in a code or data section when making an object file
Error[151]   \DELTASIGMAADC\DELTASIG.ASM 42 : Operand contains unresolvable labels or is too complex
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 42 : Executable code and data must be defined in an appropriate section
Error[150]   \DELTASIGMAADC\DELTASIG.ASM 43 : Labels must be defined in a code or data section when making an object file
 Error[152]   \DELTASIGMAADC\DELTASIG.ASM 44 : Executable code and data must be defined in an appropriate section
Error[151]   \DELTASIGMAADC\DELTASIG.ASM 45 : Operand contains unresolvable labels or is too complex
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 45 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 46 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 47 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 48 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 49 : Executable code and data must be defined in an appropriate section
Error[151]   \DELTASIGMAADC\DELTASIG.ASM 50 : Operand contains unresolvable labels or is too complex
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 50 : Executable code and data must be defined in an appropriate section
Error[151]   \DELTASIGMAADC\DELTASIG.ASM 51 : Operand contains unresolvable labels or is too complex
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 51 : Executable code and data must be defined in an appropriate section
Error[150]   \DELTASIGMAADC\DELTASIG.ASM 52 : Labels must be defined in a code or data section when making an object file
Error[150]   \DELTASIGMAADC\DELTASIG.ASM 53 : Labels must be defined in a code or data section when making an object file
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 53 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 54 : Executable code and data must be defined in an appropriate section
Error[151]   \DELTASIGMAADC\DELTASIG.ASM 55 : Operand contains unresolvable labels or is too complex
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 55 : Executable code and data must be defined in an appropriate section
Error[150]   \DELTASIGMAADC\DELTASIG.ASM 56 : Labels must be defined in a code or data section when making an object file
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 57 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 58 : Executable code and data must be defined in an appropriate section
Error[152]   \DELTASIGMAADC\DELTASIG.ASM 59 : Executable code and data must be defined in an appropriate section
Halting build on first failure as requested.


Si alguien quiere consultar la nota original aqui esta el link:
https://ww1.microchip.com/downloads/en/Appnotes/00700a.pdf

Desde ya gracias por la ayuda! :)
Aqui esta el codigo tal cual lo copie

Código: ASM
  1. ;*********************************************************************
  2. ;* Filename: DeltaSig.asm
  3. ;*********************************************************************
  4. ;* Author: Dan Butler
  5. ;* Company: Microchip Technology Inc.
  6. ;* Revision: 1.00
  7. ;* Date: 02 December 1998
  8. ;* Assembled using MPASM V2.20
  9. ;*********************************************************************
  10. ;* Include Files:
  11. ;* p16C622.inc V1.01
  12. ;*********************************************************************
  13. ;* Provides two functions implementing the Delta Sigma A2D.
  14. ;* InitDeltaSigA2D sets up the voltage reference and comparator
  15. ;* in the "idle" state.
  16. ;* DeltaSigA2D runs the actual conversion. Results provided in
  17. ;* result_l and result_h.
  18. ;* See An700 figure 2 for external circuitry required.
  19. ;*********************************************************************
  20. ;* What's changed
  21. ;*
  22. ;* Date Description of change
  23. ;*
  24. ;*********************************************************************
  25. #include        <p16f628a.inc>
  26. cblock
  27.                         result_l
  28.                         result_h
  29.                         counter:2
  30. endc
  31. ;
  32. ;
  33. ;
  34. ;InitDeltaSigA2D
  35.                         bsf             STATUS,RP0
  36.                         movlw           0xEC
  37.                         movwf           VRCON
  38.                         bcf             PORTA,3         ;
  39.                         bcf             STATUS,RP0
  40.                         movlw           0x06            ;
  41.                         movwf           CMCON
  42.                         return
  43. ;
  44. ; Delta Sigma A2D
  45. ; The code below contains a lot of nops and goto next instruction. These
  46. ; are necessary to ensure that each pass through the loop takes the same
  47. ; amount of time, no matter the path through the code.
  48. ;DeltaSigA2D
  49.                         clrf            counter
  50.                         clrf            counter+1
  51.                         clrf            result_l
  52.                         clrf            result_h
  53.                         movlw   0x03            ;
  54.                         movwf   CMCON
  55. loop
  56.                         btfsc           CMCON,C1OUT     ;
  57.                         goto            complow         ;
  58. comphigh
  59.                         nop
  60.                         bcf             PORTA,3         ;
  61.                         incfsz    result_l,f    ;
  62.                         goto            eat2cycles      ;
  63.                         incf            result_h,f      ;
  64.                         goto            endloop         ;
  65. complow
  66.                         bsf             PORTA,3         ;
  67.                         nop                                             ;
  68.                         goto            eat2cycles      ;
  69. eat2cycles
  70.                         goto            endloop         ;
  71. endloop
  72.                         incfsz  counter,f       ;
  73.                         goto            eat5cycles      ;
  74.                         incf            counter+1,f     ;
  75.                         movf            counter+1,w     ;
  76.                         andlw   0x04            ;
  77.                         btfsc           STATUS,Z        ;
  78.                         goto            loop            ;
  79.                         goto            exit            ;
  80. eat5cycles
  81.                         goto            $+1             ;
  82.                         nop                             ;
  83.                         goto            loop            ;
  84. exit
  85.                         movlw   0x06            ;
  86.                         movwf   CMCON          
  87.                         return
  88.                         end

Desconectado Ale_arzer

  • PIC10
  • *
  • Mensajes: 9
Re:Problema al compilar un ejemplo de Microchip
« Respuesta #1 en: 01 de Junio de 2023, 02:40:11 »
Buenas, si usa el Mplab X Ide en sus últimas versiones, el compilador ya no es mpasm, cómo se usaba antes, ahora es pic- as y tiene algunas diferencias, se debe indicar en el programa las secciones, por así llamarlo, de código, definición de variables. También diferencias de sintaxis. Creo yo que es por eso más que te tira siempre ese error de código y datos deben ser definidos en la sección apropiada. Deberías leer la guía de migración de MPASM a PIC-AS para ver las diferencias, o interiorizarte en aprender de 0 con PIC-AS si es que no has usado MPASM . https://ww1.microchip.com/downloads/en/DeviceDoc/MPASM%20to%20MPLAB%20XC8%20PIC%20Assembler%20Migration%20Guide%2050002973A.pdf ahí está dicha guía. Suerte

Conectado Falkenauges01

  • PIC10
  • *
  • Mensajes: 8
Re:Problema al compilar un ejemplo de Microchip
« Respuesta #2 en: 01 de Junio de 2023, 22:39:29 »
Solucionado!
Al principio no me percate de que en el mismo código indicaba que versión de MPASM utilizaba (V2.2) por lo tanto yo al querer ensamblarlo en la versión que poseo (V5.51) y tambien en MPLAB X (pic-as) no funcionaba por la misma razón que comenta Ale_arzer,
la solución fue descargar una versión más antigua de MPLAB (6.10) del sitio oficial de Microchip y ahi si funciono.
Gracias por la ayuda! :)