|
Comunidad de discusión sobre Automatización, Electrónica industrial, Microcontroladores y electrónica digital, Robótica, Domótica, Telemática, Tecnologías móviles, y muchos temas más.
Manejar bien las ID del 16F84A
 | #1 Manejar bien las ID del 16F84A |  |
|
Meta
| Ubicación: 16F84A |
| Registrado: 20 Ene 2008 |
| Mensajes: 1190 |
|
 |
| Publicado: 04 Sep 2008, 6:37 am |
|
|
 |
 |
Hola:
Quiero hacer el programa con el MPLAB 8.10 en ASM la mejor manera posible que no salga ningún Warning.
Empezando desde la dirección ORG 2000 a 2003.
He puesto:
- Código: Seleccionar todo
ORG 2000
DT "100", 0x00
; Me sigue saliendo los Warning.
Después probé de esta manera:
- Código: Seleccionar todo
ORG 2000 ; Dirección del ID.
retlw 0x01
ORG 2001
retlw 0x00
ORG 2002
retlw 0x00
ORG 2003
retlw 0x00
; Me sigue con el mismo mensaje.
Lo mismo con este otro:
- Código: Seleccionar todo
ORG 2000 ; Dirección del ID.
retlw 0x01
retlw 0x00
retlw 0x00
retlw 0x00
; Haga lo que haga me pasa lo mismo.
- Código: Seleccionar todo
ORG 2000 ; Dirección del ID.
addlw 0x01
addlw 0x00
addlw 0x00
addlw 0x00
¿Hay alguna manera de solucionar esto? El ID lo quiero para indicar la versión del programa, que está para eso. Eso si, al cargar el .hex al winPic800 o el ic-prog, funciona bien.
Otra cosa.
He probado guardar datos en la EEPROM interna del 16F84A de esta manera que es como debe ser.
- Código: Seleccionar todo
ORG 2100 ; Dirección de la EEPROM.
[b]DE[/b] "Nombre.asm, Version 1.0, nombreAgmail.com, 04-09-2008", 0x00
Al principio sin querer puse DT en vez de DE y compilaba igual. ¿Hay algún posible problema en un posible futuro que pase algo no muy grato?
Un cordial saludos.
|
|
|
 | #2 Re: Manejar bien las ID del 16F84A |  |
|
Alejandro Sherar
| Ubicación: Va. Martelli, Bs. As., Argentina |
| Registrado: 07 Abr 2008 |
| Mensajes: 709 |
|
 |
| Publicado: 04 Sep 2008, 8:02 am |
|
|
 |
 |
Podés postear el warning ?
|
|
|
|
Meta
| Ubicación: 16F84A |
| Registrado: 20 Ene 2008 |
| Mensajes: 1190 |
|
 |
| Publicado: 04 Sep 2008, 8:05 am |
|
|
 |
 |
Me olvidé de ponerlo.
----------------------------------------------------------------------
Debug build of project `C:\PIC16F84\X10.disposable_mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Thu Sep 04 14:05:13 2008
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\PIC16F84\X10.mcs".
Clean: Done.
Executing: "C:\Archivos de programa\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "X10.ASM" /l"X10.lst" /e"X10.err" /d__DEBUG=1
Warning[220] C:\PIC16F84\X10.ASM 17 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\X10.ASM 18 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\X10.ASM 19 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\X10.ASM 20 : Address exceeds maximum range for this processor.
Loaded C:\PIC16F84\X10.cod.
----------------------------------------------------------------------
Debug build of project `C:\PIC16F84\X10.disposable_mcp' succeeded.
Preprocessor symbol `__DEBUG' is defined.
Thu Sep 04 14:05:17 2008
----------------------------------------------------------------------
BUILD SUCCEEDED
|
|
|
|
Alejandro Sherar
| Ubicación: Va. Martelli, Bs. As., Argentina |
| Registrado: 07 Abr 2008 |
| Mensajes: 709 |
|
 |
| Publicado: 04 Sep 2008, 8:43 am |
|
|
 |
 |
Fijate en este ejemplo del Ayuda del MPLAB (Help -> Topics -> MPASM Assembler)
Yo compilo esto:
- Código: Seleccionar todo
;PIC16 Application Example - de
#include p16f84a.inc
org 2100
de "My Program, v1.0", 0
ch_tbl2 de "PICmicro"
end
y el resultado que me sale es:
- Código: Seleccionar todo
----------------------------------------------------------------------
Debug build of project `C:\Meta\Meta.mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Thu Sep 04 10:41:01 2008
----------------------------------------------------------------------
Make: The target "C:\Meta\ppal.o" is out of date.
Executing: "C:\Archivos de programa\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "ppal.asm" /l"ppal.lst" /e"ppal.err" /d__DEBUG=1
Loaded C:\Meta\ppal.cod.
----------------------------------------------------------------------
Debug build of project `C:\Meta\Meta.mcp' succeeded.
Preprocessor symbol `__DEBUG' is defined.
Thu Sep 04 10:41:01 2008
----------------------------------------------------------------------
BUILD SUCCEEDED
El problema lo tenés en la instrucción "retlw" no en el "org"
Es que la instrucción no se puede poner en EEPROM, si el valor ... OJO!
Deberías hacer así:
- Código: Seleccionar todo
#include p16f84a.inc
org 2100
de 0x01
de 0x00
de 0x00
de 0x00
end
|
|
Ultima edición por Alejandro Sherar el 04 Sep 2008, 3:23 pm, editado 6 veces
|
|
Meta
| Ubicación: 16F84A |
| Registrado: 20 Ene 2008 |
| Mensajes: 1190 |
|
 |
| Publicado: 04 Sep 2008, 8:47 am |
|
|
 |
 |
jejejeej, esa es la EEPROM.
La parte que digo y no me da buenas aquellas es en la dirección:
- Código: Seleccionar todo
ORG 2000
DT "100", 0x00
|
|
|
|
Alejandro Sherar
| Ubicación: Va. Martelli, Bs. As., Argentina |
| Registrado: 07 Abr 2008 |
| Mensajes: 709 |
|
 |
| Publicado: 04 Sep 2008, 9:04 am |
|
|
 |
 |
Glup! Tenes razon.
DT genera una tabla con retlw
No te la deja usar más allá de .1023 porque el pic 16F84A tiene solo 1k de memoria !
Eso en hexa es 0x400
Esto no genera "tus" warnings
- Código: Seleccionar todo
#include p16f84a.inc
org .1023
dt 0x1
end
Para las ID te recomiendan esto:
- Código: Seleccionar todo
#include p16f84a.inc
__idlocs 0x1234 ;Sets device ID to 1234
end
|
|
|
|
Meta
| Ubicación: 16F84A |
| Registrado: 20 Ene 2008 |
| Mensajes: 1190 |
|
 |
| Publicado: 04 Sep 2008, 10:18 am |
|
|
 |
 |
Hola:
Ya me funciona lo del __idlocs. Fui a buscarlo en el P16F84A.INC y no encontré nada, me pregunté dónde lo podrías sacar esa información sin ser internet cosa que me da que fue en la ayuda del MPLAB.
- Código: Seleccionar todo
__idlocs - Set Processor ID Locations
Note: idlocs is preceded by two underline characters.
Syntax
__idlocs expr
__idlocs addr, expr (PIC18 Only)
Description
For PIC12 and PIC16 devices, __idlocs sets the four ID locations to the hexadecimal value of expr. For example, if expr evaluates to 1AF, the first (lowest address) ID location is zero, the second is one, the third is ten, and the fourth is fifteen.
For PIC18 devices, __idlocs sets the two-byte device ID at location addr to the hexadecimal value of expr.
Before this directive is used, the processor must be declared through the command line, the list directive, or the processor directive.
Usage
This directive is used in the following types of code: absolute or relocatable. For information on types of code, see Assembler Operation.
This directive is not commonly used, but does provide an easy method of serializing devices. __idlocs can be read by a programmer. PIC18 devices can read this value at run-time, but PIC12/16 devices cannot.
See Also
__config config list processor
Simple Example
Example 1: PIC16 Devices
#include p16f877a.inc ;Include standard header file
;for the selected device.
__idlocs 0x1234 ;Sets device ID to 1234.
Example 2: PIC18 Devices
Note: The most significant nibble of __idlocs is always 0x0, according to the programming specification.
#include p18f452.inc ;Include standard header file
;for the selected device.
__idlocs _IDLOC0, 0x1 ;IDLOC register 0 will be
;programmed to 1.
__idlocs _IDLOC1, 0x2 ;IDLOC register 1 will be
;programmed to 2.
__idlocs _IDLOC2, 0x3 ;IDLOC register 2 will be
;programmed to 3.
__idlocs _IDLOC3, 0x4 ;IDLOC register 3 will be
;programmed to 4.
__idlocs _IDLOC4, 0x5 ;IDLOC register 4 will be
;programmed to 5.
__idlocs _IDLOC5, 0x6 ;IDLOC register 5 will be
;programmed to 6.
__idlocs _IDLOC6, 0x7 ;IDLOC register 6 will be
;programmed to 7.
__idlocs _IDLOC7, 0x8 ;IDLOC register 7 will be
;programmed to 8.
Muchas gracias.
|
|
|
|
Alejandro Sherar
| Ubicación: Va. Martelli, Bs. As., Argentina |
| Registrado: 07 Abr 2008 |
| Mensajes: 709 |
|
 |
| Publicado: 04 Sep 2008, 3:21 pm |
|
|
 |
 |
Hubiera bastado con preguntar.
Yo te hubiera mandado a este enlace.
JEJEJEJE
Ufa! Bueno, .... por lo menos se arregló el problema!
|
|
Ultima edición por Alejandro Sherar el 04 Sep 2008, 8:45 pm, editado 3 veces
|
|
Meta
| Ubicación: 16F84A |
| Registrado: 20 Ene 2008 |
| Mensajes: 1190 |
|
 |
| Publicado: 04 Sep 2008, 3:30 pm |
|
|
 |
 |
Muchas gracias amigo.
|
|
|
 | Foros de Electronica |  |
|
 |