16F726 configuration


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323

    Default 16F726 configuration

    I'm trying to get through the fuse configuration on a 16F726....

    I've read Melanie's post "Presetting Configuration Fuses (PIC Defines) into your Program " a bunch of times, I've got the 16F726 data sheet open and have read the section on Device Configuration repeatedly, and I've got the M16F72X.INC open so I can see the list of fuse definitions... but I'm still confused.

    When I try to set some of the fuse definitions, I get an error that says "Symbol not previously defined "

    For example, Here I try and set some of the stuff in the CONFIG1 register:

    @ __config _CONFIG1, _INTOSCIO & _DEBUG_OFF & _WDT_OFF & _CP_OFF & _MCLR_OFF & _PLL_ON

    which returns 2 errors:
    "Symbol not previously defined (_MCLR_OFF )"
    "Symbol not previously defined (_PLL_ON)"


    If I look at the M16F72X.INC file, it sure LOOKS like MCLR_OFF and PLL_ON are defined..?

    Code:
    					; *** DEVICE Fuses Definitions
    EXTRC_OSC_CLKOUT equ    3FF80007h       ; XX XXXX XXXX X111
    EXTRC_OSC_NOCLKOUT equ  3FF80006h       ; XX XXXX XXXX X110
    EXTRCIO         equ     3FF80006h       ; XX XXXX XXXX X110
    EXTRC           equ     3FF80006h       ; XX XXXX XXXX X110
    INTRC_OSC_CLKOUT equ    3FF80005h       ; XX XXXX XXXX X101
    INTRC_OSC_NOCLKOUT equ  3FF80004h       ; XX XXXX XXXX X100
    INTOSCIO        equ     3FF80004h       ; XX XXXX XXXX X100
    INTOSC          equ     3FF80004h       ; XX XXXX XXXX X100
    EC_OSC          equ     3FF80003h       ; XX XXXX XXXX X011
    HS_OSC          equ     3FF80002h       ; XX XXXX XXXX X010
    XT_OSC          equ     3FF80001h       ; XX XXXX XXXX X001
    LP_OSC          equ     3FF80000h       ; XX XXXX XXXX X000
    WDT_ON          equ     3FF70008h       ; XX XXXX XXXX 1XXX
    WDT_OFF         equ     3FF70000h       ; XX XXXX XXXX 0XXX
    PWRT_ON         equ     3FEF0000h       ; XX XXXX XXX0 XXXX
    PWRT_OFF        equ     3FEF0010h       ; XX XXXX XXX1 XXXX
    MCLR_ON         equ     3FDF0020h       ; XX XXXX XX1X XXXX
    MCLR_OFF        equ     3FDF0000h       ; XX XXXX XX0X XXXX
    PROTECT_ON      equ     3FBF0000h       ; XX XXXX X0XX XXXX
    PROTECT_OFF     equ     3FBF0040h       ; XX XXXX X1XX XXXX
    BOD_ON          equ     3CFF0300h       ; XX XX11 XXXX XXXX
    BOD_NSLEEP      equ     3CFF0100h       ; XX XX01 XXXX XXXX
    BOD_OFF         equ     3CFF0000h       ; XX XX00 XXXX XXXX
    BORV_19         equ     3BFF4000h       ; XX X1XX XXXX XXXX
    BORV_25         equ     3BFF0000h       ; XX X0XX XXXX XXXX
    PLL_ON          equ     2FFF0000h       ; X0 XXXX XXXX XXXX
    PLL_OFF         equ     2FFF1000h       ; X1 XXXX XXXX XXXX
    DEBUG_ON        equ     1FFF0000h       ; 0X XXXX XXXX XXXX
    DEBUG_OFF       equ     1FFF2000h       ; 1X XXXX XXXX XXXX
    
    					; *** DEVICE2 Fuses Definitions
    VCAP_OFF	equ     3FCF0030h       ; XX XXXX XX11 XXXX
    VCAP_RA6	equ     3FCF0020h       ; XX XXXX XX10 XXXX
    VCAP_RA5	equ     3FCF0010h       ; XX XXXX XX01 XXXX
    VCAP_RA0	equ     3FCF0000h       ; XX XXXX XX00 XXXX
    Also, I thought I would be able to use this to set the configuration:

    Code:
    @ DEVICE pic16F726, INTOSCIO
    @ DEVICE pic16F726, DEBUG_OFF
    @ DEVICE pic16F726, WDT_OFF
    but I get error messages about "Found label after column 1. (DEVICE)
    and:
    "Illegal Opcode (pic16F726)

    I feel totally lost and bewildered...
    Anyone willing to help point me in the right direction? Please?

    FWIW, here's my little bit of test code. I've finally got it to display my sample text, but I still don't understand why I'm unable to set some of the config stuff...

    Code:
                                                                                                      
    '****************************************************************
    '****************************************************************
    
    @  __config _CONFIG1, _INTOSCIO & _DEBUG_OFF & _WDT_OFF & _MCLR_OFF & _PLL_ON
    @  __config _CONFIG2, _VCAP_RA0
    
    '@ DEVICE pic16F726, INTOSCIO      'Why did this return an error?
    '@ DEVICE pic16F726, DEBUG_OFF     'Why did this return an error?
    '@ DEVICE pic16F726, WDT_OFF       'Why did this return an error?
    
    
    Include "MODEDEFS.BAS"   ' Include Shiftin/out modes
    DEFINE LCD_DREG PORTA    ' Set LCD Data port
    DEFINE LCD_DBIT 4        ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTA   ' Set LCD Register Select port
    DEFINE LCD_RSBIT 2       ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTC    ' Set LCD Enable port
    DEFINE LCD_EBIT 0        ' Set LCD Enable bit
    DEFINE LCD_BITS 4        ' Set LCD bus size (4 or 8 bits)
    
    TRISA= %00000000    'Set 'em all to outputs
    TRISB= %00000000	'Set portB 
    TRISC= %00000000    'Set portC all outputs
        
    ANSELA= %00000000	 ' Set all pins to digital...
    ANSELB= %00000000   ' Set all pins to digital
    
    pause 200  'Give the LCD a chance to wake up
    Lcdout $fe,1
    
    gosub mainloop
           
    display: '!!!!!!!!----Display something on LCD 
    
            Lcdout $fe,2," Hey! WTF?",$fe,$C0," Anybody home?"
            return          
            
    '----------------------------------         
    mainloop: 
            gosub display
            Pause 100      ' slow things down a bit to keep everyone from freaking out               
            Goto mainloop   ' repeat until nauseated...
    
            return
    
            End
    Thanks,

    Steve

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    but I get error messages about "Found label after column 1. (DEVICE)
    That error indicates you are using MPASM as the assembler.

    In which case you need the P16F726.INC in the "C:\Program Files\Microchip\MPASM Suite" folder.

    In that file you'll find ...

    _MCLRE_OFF

    -- and --

    _PLL_EN

    hth,
    DT

  3. #3
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Thank you Darrel, that helped immensely.

    This is all a steep learning curve for me. So many manuals and data sheets to read and *understand*. Sometimes I feel like I'm making great leaps forward learning this stuff, and other times I just feel dumb as a rock...

    Thanks very much for your help!


    steve

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 09:54
  2. Warning: Some configuration words not in hex file
    By Byte_Butcher in forum General
    Replies: 2
    Last Post: - 14th December 2009, 06:25
  3. Configuration error
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 20th September 2009, 00:10
  4. meProg configuration vs setting fuses in code
    By AndrewC in forum General
    Replies: 2
    Last Post: - 10th June 2008, 14:00
  5. 4-20mA to 0-5V configuration
    By leonel in forum General
    Replies: 0
    Last Post: - 31st August 2005, 12:33

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