One step at a time...
Compile this and ensure your LED blinks on GPIO.1... ensure your LED has a suitable series Resistor...
Code:' ' PIC Defines ' ----------- @ DEVICE pic12F675, INTRC_OSC_NOCLKOUT ' System Clock Options (Internal) @ DEVICE pic12F675, WDT_ON ' Watchdog Timer @ DEVICE pic12F675, PWRT_ON ' Power-On Timer @ DEVICE pic12F675, MCLR_OFF ' Master Clear Options (Internal) @ DEVICE pic12F675, BOD_ON ' Brown-Out Detect @ DEVICE pic12F675, CPD_OFF ' Data Memory Code Protect @ DEVICE pic12F675, PROTECT_OFF ' Program Code Protection ' ' Define Hardware ' --------------- InputTrigger var GPIO.5 ' Input normally HIGH, goes LOW to Trigger InputReset var GPIO.2 ' Input normally HIGH, goes LOW to RESET OutputLine var GPIO.0 ' Normally HIGH, goes LOW when triggered LED var GPIO.1 ' ' Define Variables ' ---------------- DelayTick var Byte ' 100mS Tick Counter MyFlags var byte ' ' Initialise Hardware ' ------------------- TRISIO=%00100100 ' Preset I/O CMCON=%00000111 ' Disable Comparators ANSEL=%00000000 ' Disable ADC DelayTick=100 ' Reset Counter MyFlags=0 High OutputLine ' Everything Reset ' ' Main Program Loop ' ----------------- Loop: Pause 500 Toggle LED Goto Loop End




Bookmarks