TODOPIC
Microcontroladores PIC => Lenguaje Basic para microcontroladores PIC => Mensaje iniciado por: luisperez en 02 de Septiembre de 2010, 00:12:58
-
Hola chicos espero me puedan ayudar.
Estoy empezando a programar el 16f88 con Picbasic pro 4.46/micro code studio 3.0.0.5, al moneto compilar mis programacion no me muestra ningun error, pero al importar el .hex el pickit2 me muestra.
warning: some configuration words not in hex file
ensure default values above right are acceptable
lo que trato de hacer es un medidor de liquidos. consta de una bolla que me envia señales analogas, deacuerdo al nivel del liquido.
@ device pic16f88, xt_osc, lvp_off, wdt_off, mclr_on
define osc 4
trisa=00000001
adcon1=%1110
trisb=0
portb=0
DATO var byte
x var byte
y var byte
x=0
y=0
inicio:
Sumaunidad:
x=X+1
portb=(y*16)+x
if x=10 then sumadecena
if Y=9 and x=9 then compara
pause 25
goto sumaunidad
Sumadecena:
x=0
Y=Y+1
goto sumaunidad
Compara:
adcin 0,dato
if dato<=130 then CERO
if dato=131 then uno
if dato=132 then uno
if dato=133 then uno
if dato=134 then uno
if dato=135 then dos
if dato=136 then dos
if dato=137 then dos
if dato=138 then dos
if dato=139 then dos
if dato=140 then tres
if dato=141 then tres
if dato=142 then tres
if dato=143 then tres
if dato=144 then tres
if dato=145 then cuatro
if dato=146 then cuatro
if dato=147 then cuatro
if dato=148 then cuatro
if dato=149 then cuatro
if dato=150 then cinco
if dato=151 then cinco
if dato=152 then cinco
if dato=153 then seis
if dato=154 then seis
if dato=155 then seis
if dato=156 then siete
if dato=157 then siete
if dato=158 then siete
if dato=159 then ocho
if dato=160 then ocho
if dato=161 then ocho
if dato=162 then nueve
if dato=163 then nueve
if dato=164 then nueve
if dato=165 then portb=(1*16)+0
if dato=166 then portb=(1*16)+1
if dato=167 then portb=(1*16)+2
if dato=168 then portb=(1*16)+3
if dato=169 then portb=(1*16)+4
if dato=170 then portb=(1*16)+5
if dato=171 then portb=(1*16)+6
if dato=172 then portb=(1*16)+7
if dato=173 then portb=(1*16)+8
if dato=174 then portb=(1*16)+9
if dato=175 then portb=(2*16)+0
if dato=176 then portb=(2*16)+1
if dato=177 then portb=(2*16)+2
if dato=178 then portb=(2*16)+3
if dato=179 then portb=(2*16)+4
if dato=180 then portb=(2*16)+5
if dato=181 then portb=(2*16)+6
if dato=182 then portb=(2*16)+7
if dato=183 then portb=(2*16)+8
if dato=184 then portb=(2*16)+9
if dato=185 then portb=(3*16)+0
if dato=186 then portb=(3*16)+1
if dato=187 then portb=(3*16)+2
if dato=188 then portb=(3*16)+3
if dato=189 then portb=(3*16)+4
if dato=190 then portb=(3*16)+5
if dato=191 then portb=(3*16)+6
if dato=192 then portb=(3*16)+7
if dato=193 then portb=(3*16)+8
if dato=194 then portb=(3*16)+9
if dato=195 then portb=(4*16)+0
if dato=196 then portb=(4*16)+1
if dato=197 then portb=(4*16)+2
if dato=198 then portb=(4*16)+3
if dato=199 then portb=(4*16)+4
if dato=200 then portb=(4*16)+5
if dato=201 then portb=(4*16)+6
if dato=202 then portb=(4*16)+7
if dato=203 then portb=(4*16)+8
if dato=204 then portb=(4*16)+9
if dato=205 then portb=(5*16)+0
if dato=206 then portb=(5*16)+1
if dato=207 then portb=(5*16)+2
if dato=208 then portb=(5*16)+3
if dato=209 then portb=(5*16)+4
if dato=210 then portb=(5*16)+5
if dato=211 then portb=(5*16)+6
if dato=212 then portb=(5*16)+7
if dato=213 then portb=(5*16)+8
if dato=214 then portb=(5*16)+9
if dato=215 then portb=(6*16)+0
if dato=216 then portb=(6*16)+1
if dato=217 then portb=(6*16)+2
if dato=218 then portb=(6*16)+3
if dato=219 then portb=(6*16)+4
if dato=220 then portb=(6*16)+5
if dato=221 then portb=(6*16)+6
if dato=222 then portb=(6*16)+7
if dato=223 then portb=(6*16)+8
if dato=224 then portb=(6*16)+9
if dato=225 then portb=(7*16)+0
if dato=226 then portb=(7*16)+1
if dato=227 then portb=(7*16)+2
if dato=228 then portb=(7*16)+3
if dato=229 then portb=(7*16)+4
if dato=230 then portb=(7*16)+5
if dato=231 then portb=(7*16)+6
if dato=232 then portb=(7*16)+7
if dato=233 then portb=(7*16)+8
if dato=234 then portb=(7*16)+9
if dato=235 then portb=(8*16)+0
if dato=236 then portb=(8*16)+1
if dato=237 then portb=(8*16)+2
if dato=238 then portb=(8*16)+3
if dato=239 then portb=(8*16)+4
if dato=240 then portb=(8*16)+5
if dato=241 then portb=(8*16)+6
if dato=242 then portb=(8*16)+7
if dato=243 then portb=(8*16)+8
if dato=244 then portb=(8*16)+9
if dato=245 then portb=(9*16)+0
if dato=246 then portb=(9*16)+1
if dato=247 then portb=(9*16)+2
if dato=248 then portb=(9*16)+3
if dato=249 then portb=(9*16)+4
if dato=250 then portb=(9*16)+5
if dato=251 then portb=(9*16)+6
if dato=252 then portb=(9*16)+7
if dato=253 then portb=(9*16)+8
if dato=254 then portb=(9*16)+8
if dato=255 then portb=(9*16)+9
goto Compara
ALERTAS:
CERO
portb=0:pause 100
gosub apaga
goto compara
UNO:
portb=1:pause 100
gosub apaga
goto compara
DOS:
portb=2:pause 100
gosub apaga
goto compara
TRES:
portb=3:pause 100
gosub apaga
goto comparA
CUATRO:
portb=4:pause 100
gosub apaga
goto compara
CINCO:
portb=5:pause 100
gosub apaga
goto compara
SEIS:
portb=6:pause 100
gosub apaga
goto compara
SIETE:
portb=7:pause 100
gosub apaga
goto compara
OCHO:
portb=8:pause 100
gosub apaga
goto compara
NUEVE:
portb=9:pause 100
gosub apaga
goto compara
Apaga:
portb=(15*16)+15:pause 200
return
end
(http://)
Espero me puedan ayudar.
-
Dice que algunos bits de configuración no están definidos en el HEX que estás usando. Pickit2 entonces los pondrá a valores predeterminados.
Sólo declara los bits que necesites cambiar. Si no son importantes puedes ignorar el warning.
-
Como podria cambiar esos bits, ya k aun asi grabandolo no funcionada nada de mi programacion...gracias por tu ayuda
-
Ahí mismo en pickit2. Da click en Configuration y se abrirá una ventana con cada bit.
-
Gracias amigo por tu pronta respuesta, pero no se que podria cambiar ahi....(disculpa mi ignorancia), que bits debo cambiar?.... :oops:
-
Gracias amigo por tu pronta respuesta, pero no se que podria cambiar ahi....(disculpa mi ignorancia), que bits debo cambiar?.... :oops:
Los bits que no has configurado en la directiva @ device pic16f88, xt_osc, lvp_off, wdt_off, mclr_on
Si hay alguno que creas que esté faltando, lee la datasheet del micro en la sección Configuration Bits.
-
Mmmm ya comprendo a lo que te refieres, bueno en efecto tengo que cambiar algunas algunos bits, pero hay algunos fuses que no comprendo:
CONFIGURATION WORD 1 REGISTER (ADDRESS 2007h)
CCPMX: CCP1 Pin Selection bit
1 = CCP1 function on RB0
0 = CCP1 function on RB3
DEBUG: In-Circuit Debugger Mode bit
1 = In-Circuit Debugger disabled, RB6 and RB7 are general purpose I/O pins
0 = In-Circuit Debugger enabled, RB6 and RB7 are dedicated to the debugger
BOREN: Brown-out Reset Enable bit
1 = BOR enabled
0 = BOR disabled
PWRTEN: Power-up Timer Enable bit
1 = PWRT disabled
0 = PWRT enabled
Configuration 2008
bit 13-2 Unimplemented: Read as ‘1’
bit 1 IESO: Internal External Switchover bit
1 = Internal External Switchover mode enabled
0 = Internal External Switchover mode disabled
bit 0 FCMEN: Fail-Safe Clock Monitor Enable bit
1 = Fail-Safe Clock Monitor enabled
0 = Fail-Safe Clock Monitor disabled
Gracias por tu ayuda..... :oops:
-
No te preocupes, aquí los detalles:
CCPMX
Se usa para elegir la salida/entrada del módulo Compare. Comúnmente para elegir por dónde saldrá el PWM.
DEBUG
Se usa para elegir una pareja de pines para poder depurar el pic en tiempo real.
BOREN
Se usa para activar el modo de reset cuando el voltaje de alimentación del pic está fuera de lugar.
PWRTEN
Activa un retraso de tiempo desde que el pic recibe voltaje de alimentación correcto hasta que se arranca el reloj del procesador. Normalmente los pics tienen un retraso para estabilizar el cristal, pero éste es un tiempo extra.
IESO
No sé qué haga, pero no hace falta que lo cambies.
FCMEN
Sirve para cuando quieres cambiar el modo oscilador del pic y éste te permite que lo hagas de forma segura.
Al ver que no conoces estos conf bits entonces no hace falta que los cambies, déjalos en default.
Pickit2 te lo notifica porque es un software muy potente que cuida todo detalle de la programación, pero puedes dejar esos conf bits en default.
-
Hola gracias por tu ayuda...eh aprendido nuevas cosas....
Respecto al proyecto, inicialmente mi declaración de los fuses no muy poca, y te mencione que no funcionaba, aun grabandolo por defecto, bien eh modificado esos fuses con lo aprendido, y wala! pude terminar mi proyecto.
Así quedaría la mi nuevo código.
@ device pic16f88,mclr_on,lvp_off,wdt_off,intrc_osc_noclkout,bod_off,debug_off
@ device pwrt_on,cpd_off
OSCCON=%1100100
DEFINE ADC_BITS 8
define SDC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
trisa=%1
ADCON1=%00001110
trisb=0
portb=0
DATO var byte
x var byte
y var byte
x=0
y=0
inicio:
pause 50
adcin porta.0,x
pause 50
portb=x
goto inicio
end