Problema con mikrobasic

Thread Starter

joselitri

Joined Nov 2, 2009
1
hola compañeros.
tengo un problema con un programa..
uso un pic16f887 y la configuracion por defecto
HS_OSC,WDT_OFF y VLP_OFF
el problema es que NO puedo apagar los puertos..solo puedo encenderlos.
Rich (BB code):
dim oldstate, oldstate1, oldstate2, oldstate3 as BYTE
main:


TRISB = 0xFF
TRISD = 0x00
PORTD = 0
ANSEL = 0
ANSELH = 0
while true

      if (Button(PORTB, 0, 10, 1)) then
         oldstate=1
      end if
      if (oldstate and Button(PORTB, 0, 10, 0)) then
         PORTD.0 = NOT PORTD.0
         oldstate = 0
      end if

      if (Button(PORTB, 1, 1, 1)) then
         oldstate1=1
      end if
      if (oldstate1 and Button(PORTB, 1, 1, 0)) then
         PORTD.1 = NOT (PORTD.1)
         oldstate1 = 0
      end if

      if (Button(PORTB, 2, 1, 1)) then
         oldstate2=1
      end if
      if (oldstate2 and Button(PORTB, 2, 1, 0)) then
         PORTD.2 = NOT PORTD.2
         oldstate2 = 0
      end if

      if (Button(PORTB, 3, 1, 1)) then
         oldstate3=1
      end if
      if (oldstate3 and Button(PORTB, 3, 1, 0)) then
         PORTD.3 = NOT (PORTD.3)
         oldstate3 = 0
      end if

wend
end.
otro problema es que si pongo TRISB=0XFF no funciona nada, tengo que poner TRISB=0X00 (es muy estraño) y el pic funciona porque lo uso en otras aplicaciones.. gracias
 

Markd77

Joined Sep 7, 2009
2,806
<google translation from Spanish> (traducción de Google en español)

hola compañeros.
I have a problem with a program ..
I use a pic16f887 and the default configuration
HS_OSC, WDT_OFF and VLP_OFF
The problem is that I can't turn off ports .. I can only turn them on.

Another problem is that if I TRISB = 0xff nothing else works, I have to TRISB = 0X00 (very strange) and the pic works because I use it in other applications .. thanks
 
Top