list p=16f88, r=dec
errorlevel -306 ; no page boundary warnings
errorlevel -302 ; no bank 0 warnings
errorlevel -202 ; no 'argument out of range' warnings
__config 0x2007, 0x3fff
__config 0x2008, 0x3fff
datahi_set macro val
bsf 3, 6 ; STATUS<rp1>
endm
datahi_clr macro val
bcf 3, 6 ; STATUS<rp1>
endm
datalo_set macro val
bsf 3, 5 ; STATUS<rp0>
endm
datalo_clr macro val
bcf 3, 5 ; STATUS<rp0>
endm
irp_clr macro
bcf 3, 7 ; STATUS<irp>
endm
irp_set macro
bsf 3, 7 ; STATUS<irp>
endm
branchhi_set macro lbl
bsf 10, 4 ; PCLATH<4>
endm
branchhi_clr macro lbl
bcf 10, 4 ; PCLATH<4>
endm
branchlo_set macro lbl
bsf 10, 3 ; PCLATH<3>
endm
branchlo_clr macro lbl
bcf 10, 3 ; PCLATH<3>
endm
v_on EQU 1
v_off EQU 0
v_output EQU 0
v__portb EQU 0x0006 ; _portb
v__portb_shadow EQU 0x0023 ; _portb_shadow
v_adcon0 EQU 0x001f ; adcon0
v_trisb EQU 0x0086 ; trisb
v_pin_b3_direction EQU 0x0086 ; pin_b3_direction-->trisb:3
v_ansel EQU 0x009b ; ansel
v_cmcon EQU 0x009c ; cmcon
v_adcon1 EQU 0x009f ; adcon1
v__pic_temp EQU 0x0020 ; _pic_temp-->_pic_state
v__pic_state EQU 0x0020 ; _pic_state
v___x_54 EQU 0x0023 ; x-->_portb_shadow:3
v___x_55 EQU 0x0023 ; x-->_portb_shadow:3
org 0
l__main
datalo_set v_ansel
clrf v_ansel
datalo_clr v_adcon0
clrf v_adcon0
datalo_set v_adcon1
clrf v_adcon1
movlw 7
movwf v_cmcon
bcf v_trisb, 3 ; pin_b3_direction
l__l86
datalo_clr v__portb_shadow ; x54
bsf v__portb_shadow, 3 ; x54
movf v__portb_shadow,w
movwf v__portb
datalo_clr v__pic_temp
datahi_clr v__pic_temp
movlw 23
movwf v__pic_temp
l__l96
movlw 103
movwf v__pic_temp+1
l__l97
movlw 41
movwf v__pic_temp+2
l__l98
branchhi_clr l__l98
branchlo_clr l__l98
decfsz v__pic_temp+2,f
goto l__l98
branchhi_clr l__l97
branchlo_clr l__l97
decfsz v__pic_temp+1,f
goto l__l97
branchhi_clr l__l96
branchlo_clr l__l96
decfsz v__pic_temp,f
goto l__l96
bcf v__portb_shadow, 3 ; x55
movf v__portb_shadow,w
movwf v__portb
datalo_clr v__pic_temp
datahi_clr v__pic_temp
movlw 23
movwf v__pic_temp
l__l99
movlw 103
movwf v__pic_temp+1
l__l100
movlw 41
movwf v__pic_temp+2
l__l101
branchhi_clr l__l101
branchlo_clr l__l101
decfsz v__pic_temp+2,f
goto l__l101
branchhi_clr l__l100
branchlo_clr l__l100
decfsz v__pic_temp+1,f
goto l__l100
branchhi_clr l__l99
branchlo_clr l__l99
decfsz v__pic_temp,f
goto l__l99
goto l__l86
end
LIST p=16F88 ;tell assembler what chip we are using
#include <P16F88.inc> ;include the defaults for the chip
;set up config register
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
cblock 0x20
d1
d2
d3
endc
org 0x0000 ;org sets the origin, 0x0000 for the 16F88,
;this is where the program starts running
goto init
init
bsf STATUS, RP0 ;select bank 1
movlw b'01110110' ;set osc to 8mhz
movwf OSCCON
movlw b'11000110' ;set up prescaler to 128 on Tmr0
movwf OPTION_REG
movlw 0x00
movwf ANSEL
movlw b'00000000' ;set PortA all outputs
movwf TRISA
movlw b'11111111'
movwf TRISB ;set PortB all inputs
bcf STATUS, RP0 ;select bank 0
clrf PORTA ;clear portA
clrf PORTB
Loop
bsf PORTA,0
;set bit 0 on
call Delay
;
bcf PORTA,0
call Delay ;set bit0 off
goto Loop ;go back and do it again
Delay
;delay of 500msec at 8mhz clock
;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
return
end
These capacitors are rarely needed for functionality. I never saw a PIC that refused to work at all, and then worked with 100nF applied. But yes in general there should be something, 1uF, 220uF, or whatever is available.A few thoughts:
Ideally you would have a 100nF capacitor connected between pin 5 and 14.
Try changing the TRISB setting to b'00000000' - unconnected pins should be set as output to avoid oscillations.
Change part of the config line from _MCLR_OFF to _MCLR_ON. With the resistor still in place and power connected, try touching a wire from the MCLR pin (pin 4) to ground a few times and see if resetting it helps.
The most recent post in this thread describes how to start using the simulator.
http://forum.allaboutcircuits.com/showthread.php?t=44852