If you are using PBP, then I question why you are using PBC instructions like 'SYMBOL'?
I have absolutely no idea what you are trying to achieve, but the code below will at least do something... whether it is what you want is another matter.
I don't know how you have your switches connected, but you should ensure the PIC pins on PORTA are not left floating at any time.Code:LED1 var PORTB.0 'PIN 6 LED2 var PORTB.1 'PIN 7 LED3 var PORTB.2 'PIN 8 SW1 var PORTA.0 'PIN 17 SW2 var PORTA.1 'PIN 18 SW3 var PORTA.2 'PIN 1 TRISA=%00000111 TRISB=0 CMCON=%00000111 LOW LED1 LOW LED2 LOW LED3 PAUSE 5000 'TIEMPO DE ESPERA PARA ARMAR LA ALARMA LOOP: IF SW1 = 1 THEN PORTB = %00000110 Pause 3000 ENDif IF SW2 = 1 THEN PORTB = %01011011 Pause 6000 ENDIF IF SW3 = 1 THEN PORTB = %01001111 Pause 8000 ENDIF PORTB=0 GOTO LOOP END
Next time, if it is PBP you are using, post your question in the Mel PICBASIC Pro category as a New Thread.




Bookmarks