Hi Guys,
Playing about with a 12F863 chip for a small project, but to start with thought I would do the basic LEDs flash to ensure programming and that the PIC runs. The code compiled, and ran, flashing the LED on RA0 (on the EasyPIC5 board, which corresponds to GPIO.0). I then added a simple "if then" statement so that if a switch was pressed taking GPIO.1 low the code would jump to the section to flash the LED. But when compiled and loaded to the chip the LED still continues to flash regardless if the switch is pressed or not. I've enabled the pull up on the development board which has no effect
Any ideas why ?Code:ASM __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF endasm TRISIO = %11111110 ANSEL = 0 GPIO.0 = 0 CMCON0=7 Motor var GPIO.0 Switch1 var GPIO.1 Switch2 var GPIO.2 main: If Switch1 = 0 then goto demo else goto main demo: high Motor pause 1000 low Motor pause 1000 goto main endif Goto main




Bookmarks