PDA

View Full Version : Help with code, settings



xobx
- 6th September 2007, 20:52
I cant get this code to work with my PIC16F887 :/


@ device pic16F887, hs_osc, wdt_off, mclr_on, lvp_off, protect_off
DEFINE OSC 20

loop:

high portb.2
pause 500
low portb.2
pause 500
goto loop
end

Im not 100% sure if this is right, is it?


@ device pic16F887, hs_osc, wdt_off, mclr_on, lvp_off, protect_off

malc-c
- 6th September 2007, 21:01
If you are are using MPSAM and you have the correct chip selected in MCS then try



@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON


and then add then line


DEFINE OSC 20


See if that works

Rob
- 6th September 2007, 22:09
is it not compiling correctly or is it that portb.2 isn't toggling in your circuit?

if it's that it's not working in your circuit, it could be a couple of things; no pull-up resistor on MCLR, oscillator not correct or not functioning correctly (capacitors), RB.2 not set to digital or not set to an output

Cheers

Rob

Archangel
- 6th September 2007, 23:53
I cant get this code to work with my PIC16F887 :/


@ device pic16F887, hs_osc, wdt_off, mclr_on, lvp_off, protect_off
DEFINE OSC 20

loop:

high portb.2
pause 500
low portb.2
pause 500
goto loop
end

Im not 100% sure if this is right, is it?


@ device pic16F887, hs_osc, wdt_off, mclr_on, lvp_off, protect_off

For PM assembler use:


@ DEVICE PIC16F887, HS_OSC
@ DEVICE PIC16F887, WDT_OFF
@ DEVICE PIC16F887, MCLR_ON
@ DEVICE PIC16F887, LVP_OFF
@ DEVICE PIC16F887, PROTECT_OFF


For MPASM use:


@ __config _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF & MCLR_ON, & PROTECT_OFF


SEE THIS THREAD: http://www.picbasic.co.uk/forum/showthread.php?t=543&highlight=configuration+fuse

BrianT
- 7th September 2007, 00:31
If you are using a bootloader you need something like

DEFINE Loader_Used 1


near the top of your program

HTH
Brian