; eBASIC PIC16 Code Generator ; Copyright(c) 2004, Compubotics LLC ; www.Compubotics.com ORG 0x0 ; File: examples\blinky\blinky.bas ; ' Blinky example ; ' Compubotics eBASIC Compiler ; ' ; ' This example blinks an LED attached to pin 0 ; ' using the Stamp-style LOW and HIGH ; ' The OUTS register defines location of pins 0-15 ; ' On the 16F877, we have defined OUTS as address $06-$07 ; ' Therefore, pin 0 refers to PORTB:0, pin 15 to PORTC:7 ; ; #device "16f877" ; #clock 16000000 ; ; Main: nop clrf 0xa goto _startup ORG 0x4 retfie _startup: movlw 0x83 bsf 0x3,5 movwf 0x81 bcf 0xb,5 movlw 0x39 bcf 0x3,5 movwf 0x10 movlw 0x60 movwf 0x78 call _uartSetup goto Main ; ; high 0 Main: bcf 0x3,5 bcf 0x3,6 bsf 0x6,0 bsf 0x3,5 bcf 0x86,0 bcf 0x3,5 bsf 0x7a,0 ; pause 200 movlw 0xc8 movwf 0x70 movlw 0x0 movwf 0x71 call _pause ; low 0 bcf 0x3,5 bcf 0x3,6 bcf 0x6,0 bsf 0x3,5 bcf 0x86,0 bcf 0x3,5 bsf 0x7a,0 ; pause 200 movlw 0xc8 movwf 0x70 movlw 0x0 movwf 0x71 call _pause ; goto main goto Main ; ; END sleep goto $-1 _uartSetup: movlw 0x67 bsf 0x3,5 bcf 0x3,6 movwf 0x99 bsf 0x98,2 bsf 0x98,5 bcf 0x3,5 bsf 0x18,4 bsf 0x18,7 return _dec16: decf 0x70,1 incfsz 0x70,0 incf 0x71,1 decf 0x71,1 movf 0x70,0 iorwf 0x71,0 return _pause: bcf 0xb,2 btfss 0xb,2 goto $-1 call _dec16 btfss 0x3,2 goto _pause return END ; end of code generation