PIC 18F1330 - first time, hard time - blink that LED


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891

    Default PIC 18F1330 - first time, hard time - blink that LED

    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 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)
    .......


    Code:
    @ 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?
    Roger

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Re: PIC 18F1330 - first time, hard time - blink that LED

    Got it to work.

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

    Code:
    @ __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
    Roger

Similar Threads

  1. First time trying to flash one LED
    By firsttimer in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th December 2013, 17:38
  2. How long... LED on time without resistors?
    By Heckler in forum General
    Replies: 9
    Last Post: - 14th March 2011, 18:49
  3. DS1904 RTC - How to Convert Binary Time into Real Time/Date?
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd December 2010, 11:45
  4. elapsed time between two led flash...
    By dario in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th February 2006, 17:09
  5. Linx RF -> HSERIN time delay / time critical app...
    By batee in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th October 2004, 16:04

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts