REsolvi el problema estaba mal configurado el INTECON..................tengo un problemita ahora, esta relacionado mas con el manejo de las variable y decimales......escribi un programa quesalta 0.1 por paso si se deja presionado por mas de 1 segundo aproximadamente salta 0.5 por paso pero no logro mostrar el valor en la lcd con su decimal...................probe rutinas por alli que usan pero no logro.......creo que no menejo bien los tipor de variable les muestro el programa que logre por fin pero tiene un detalle
program Decimales
dim oldstate_a, oldstate_b as byte
dim TEA, TEB as byte
dim txt as char[7]
dim RPM as float
TEA = 0
TEB = 0
oldstate_a = 0
oldstate_b = 0
ANSEL = 0 ' Configura los AN como I/O Digitales
ANSELH = 0
TRISB = $F0 ' Configuracion del PORTB
PORTB = $0F ' Configuracion de salida del PORTB
TRISC.0 = 0 ' El Puerto C es Digital
PORTC.0 = 0 ' Initialize PORTB
Lcd_Init(PORTC)
Delay_ms(2)
LCD_Cmd(LCD_CLEAR) ' lear display
Delay_ms(2)
LCD_Cmd(LCD_CURSOR_OFF) ' turn cursor off
Delay_ms(2)
Lcd_Out(1, 1,"RPM:" )
Delay_ms(2)
while TRUE
FloatTostr(RPM, txt) ' Transforma el Conteo de Cont_L en String
Lcd_Out(1, 7, txt) ' Muestra Count_L en el LCD
' Rutina para Subir y bajar el valor de contador
' Boton de bajar el valor de las RPM, Si se mantiene pulsada
' por mas de un segundo incrementa 0.5 en cada paso
if Button(PORTB, 4, 1, 1) then
oldstate_a = 1
if TEA >= 60 then ' Si se mantiene pulsado por mas de un segundo
Delay_ms(300) ' activa una rutina de Icrementos de 0.5 a la Vez
RPM = RPM + 0.5
if RPM >= 80.0 then
RPM = 80.0
end if
else
Delay_ms(1)
TEA = TEA + 1
end if
end if
if oldstate_a and Button(PORTB, 4, 1, 0) then
if TEA <= 59 then ' Si se suelta el boton antes de segundo
RPM = RPM + 0.1 ' no hace ninguno incremento
end if
if RPM >= 80.0 then
RPM = 80.0
end if ' Se reinicia la deteccion de tecla pulsada
TEA = 0
oldstate_a = 0
end if
' Boton de bajar el valor de las RPM, Si se mantiene pulsada
' por mas de un segundo incrementa 0.5 en cada paso
if Button(PORTB, 5, 1, 1) then
oldstate_b = 1
if TEB >= 60 then
Delay_ms(300)
RPM = RPM - 0.5
if RPM <= 0.1 then
RPM = 0.1
end if
else
Delay_ms(1)
TEB = TEB + 1
end if
end if
if oldstate_b and Button(PORTB, 5, 1, 0) then
if TEB <= 59 then
RPM = RPM - 0.1
end if
if RPM <= 0.1 then
RPM = 0.1
end if
TEB = 0
oldstate_b = 0
end if
wend
end.
muestra el valor bien en la LCD pero muestra otros decimales que no me hacen falta por ejemplo 0.00000 o 0.59996 y solo me interesa el entero y un desimal espero una ayuda gracias de antemano '