be80be
Well-Known Member
I can't see why this will not work I can't get a 16f88 to Bink a led on portB it will portA
Code:
LIST p=16F88 ;tell assembler what chip we are using
include "P16F88.inc" ;include the defaults for the chip
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_ON & _BODEN_OFF & _MCLR_ON & _PWRTE_ON & _WDT_OFF & _INTRC_IO
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
cblock 0x20 ;start of general purpose registers
d1
d2
d3
endc
W_TEMP EQU 0x7D ; w register for context saving (ACCESS)
STATUS_TEMP EQU 0x7E ; status used for context saving (ACCESS)
PCLATH_TEMP EQU 0x7F ; variable used for context saving
ORG 0x0000 ; processor reset vector
GOTO START ; go to beginning of program
START:
banksel OSCCON
movlw b'00111111'
movwf OSCCON
RESET clrf STATUS ; |B0
clrf PORTA ; clear Port A data latches |B0
clrf PORTB ; clear Port B data latches |B0
movlw h'07' ; |B0
movwf CMCON ; turn comparator off |B0
bsf STATUS,RP0 ; select bank 1 |B1
clrf TRISA ; port A all outputs |B1
clrf TRISB ; port B all outputs |B1
bcf STATUS,RP0 ; select bank 0 |B0
goto main
main:
goto blinkleds
blinkleds:
banksel PORTB
bsf PORTB,2
call delay
bcf PORTB,2
call delay
goto blinkleds
delay ;999997 cycles
movlw 0x08
movwf d1
movlw 0x2F
movwf d2
movlw 0x03
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;3 cycles
goto $+1
nop
retlw 0x00
end