PDA

View Full Version : PIC 18F1330 - first time, hard time - blink that LED



flotulopex
- 1st March 2015, 18:38
Hello,

I'm using a PIC 18F1330 the first time... and it is not easy.

I'm trying to make the LED blink on PORTB.1 . My hw is simple; the oscillator is an external 8MHz crystal.

I went through lots of threads especially this one (http://www.picbasic.co.uk/forum/showthread.php?t=13306) but it still seems difficult to set the correct config fuses ("new method") if this is the reason why my code doesn't work.

The .inc file has been modified (added some colons) as usual in the PBP directory.

I'm using MCS, PBP2.60, MPASM v5.14 and PICKit3.

Most of the errors returned in MCS say:
Address exceeds maximum range for this processor
Overwriting previous address contents (000A)
Overwriting previous address contents (000B)
Address exceeds maximum range for this processor
Overwriting previous address contents (000C)
Overwriting previous address contents (000D)
.......


@ CONFIG OSC=HS, FCMEN=OFF, IESO=OFF, PWRT=OFF, BOR=OFF, WDT=OFF, MCLRE =OFF
@ CONFIG CP0=OFF, CP1=OFF, CPB=OFF, CPD=OFF, WRT0=OFF, WRT1=OFF

ADCON0 = %00000000
ADCON1 = %00001111
ADCON2 = %00000000

MAIN:
TOGGLE PORTB.1
PAUSE 500
GOTO MAIN
END

Any idea what I'm missing here?

flotulopex
- 1st March 2015, 22:33
Got it to work.

I had to use the "old fashion" way of setting the fuses.


@ __CONFIG _CONFIG1H, _OSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
@ __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOR_OFF_2L & _BORV_0_2L
@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG3L, _HPOL_HIGH_3L & _LPOL_HIGH_3L & _PWMPIN_OFF_3L
@ __CONFIG _CONFIG3H, _FLTAMX_RA7_3H & _T1OSCMX_LOW_3H & _MCLRE_OFF_3H
@ __CONFIG _CONFIG4L, _STVREN_ON_4L & _BBSIZ_BB256_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
@ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L
@ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
@ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L
@ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
@ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L
@ __CONFIG _CONFIG7H, _EBTRB_OFF_7H

MAIN:
TOGGLE PORTA.2
PAUSE 200
GOTO MAIN

END