Button problem driving me crazy!! Please help!


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    insert those config fuse at the top of your code..
    Code:
            asm
            list w=-207
            cfg1 = _HS_OSC & _MCLR_OFF & _CCP1_RB2 & _BODEN_ON & _PWRTE_ON &_WDT_OFF 
            cfg2 = _LVP_OFF & _DEBUG_OFF & _CP_OFF & _WRT_ENABLE_OFF & _CPD_OFF 
            list w=+207
            __CONFIG cfg1 & cfg2
            endasm
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default

    Its more a manner of style I presume, but, here's how I prefer to configure the device

    Code:
    @  device  HS_OSC, MCLR_OFF, PWRT_ON, WDT_OFF 
    @  device  PROTECT_ON,BOD_ON, CPD_ON
    To understand these defines, look at the M16F81x.INC file. They are all listed there.
    Excerpted from the file
    Code:
    					; *** DEVICE Fuses Definitions
    EXTRC_OSC_CLKOUT equ    3FEC0013h       ; XX XXXX XXX1 XX11
    EXTRC_OSC_NOCLKOUT equ  3FEC0012h       ; XX XXXX XXX1 XX10
    EXTRC_OSC       equ     3FEC0012h       ; XX XXXX XXX1 XX10
    INTRC_OSC_CLKOUT equ    3FEC0011h       ; XX XXXX XXX1 XX01
    INTRC_OSC_NOCLKOUT equ  3FEC0010h       ; XX XXXX XXX1 XX00
    INTRC_OSC       equ     3FEC0010h       ; XX XXXX XXX1 XX00
    EXTCLK_OSC      equ     3FEC0003h       ; XX XXXX XXX0 XX11
    EC_OSC          equ     3FEC0003h       ; XX XXXX XXX0 XX11
    HS_OSC          equ     3FEC0002h       ; XX XXXX XXX0 XX10
    XT_OSC          equ     3FEC0001h       ; XX XXXX XXX0 XX01
    LP_OSC          equ     3FEC0000h       ; XX XXXX XXX0 XX00
    WDT_ON          equ     3FFB0004h       ; XX XXXX XXXX X1XX
    WDT_OFF         equ     3FFB0000h       ; XX XXXX XXXX X0XX
    PWRT_ON         equ     3FF70000h       ; XX XXXX XXXX 0XXX
    PWRT_OFF        equ     3FF70008h       ; XX XXXX XXXX 1XXX
    MCLR_ON         equ     3FDF0020h       ; XX XXXX XX1X XXXX
    MCLR_OFF        equ     3FDF0000h       ; XX XXXX XX0X XXXX
    BOD_ON          equ     3FBF0040h       ; XX XXXX X1XX XXXX
    BOD_OFF         equ     3FBF0000h       ; XX XXXX X0XX XXXX
    LVP_ON          equ     3F7F0080h       ; XX XXXX 1XXX XXXX
    LVP_OFF         equ     3F7F0000h       ; XX XXXX 0XXX XXXX
    CPD_ON          equ     3EFF0000h       ; XX XXX0 XXXX XXXX
    CPD_OFF         equ     3EFF0100h       ; XX XXX1 XXXX XXXX
    WRT_1FOURTH     equ     39FF0000h       ; XX X00X XXXX XXXX
    WRT_HALF        equ     39FF0200h       ; XX X01X XXXX XXXX
    WRT_3FOURTHS    equ     39FF0400h       ; XX X10X XXXX XXXX
    WRT_OFF         equ     39FF0600h       ; XX X11X XXXX XXXX
    DEBUG_ON        equ     37FF0000h       ; XX 0XXX XXXX XXXX
    DEBUG_OFF       equ     37FF0800h       ; XX 1XXX XXXX XXXX
    CCPMX_ON        equ     2FFF0000h       ; X0 XXXX XXXX XXXX
    CCPMX_OFF       equ     2FFF1000h       ; X1 XXXX XXXX XXXX
    PROTECT_ON      equ     1FFF0000h       ; 0X XXXX XXXX XXXX
    PROTECT_OFF     equ     1FFF2000h       ; 1X XXXX XXXX XXXX
    I think this makes it independent of whether you use MPASM or PM assembler.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yup, but i NEVER use PM, it's way to limited when you compare with MPASM function set. AND it work for ALL pic family, from 10f to pic32

    The right syntax for MPASM would be..
    Code:
    @    __CONFIG _HS_OSC & _MCLR_OFF & _CCP1_RB2 & _BODEN_ON & _PWRTE_ON &_WDT_OFF & _LVP_OFF & _DEBUG_OFF & _CP_OFF & _WRT_ENABLE_OFF & _CPD_OFF
    but it's way too long, why i've splitted in 2 lines. LIST directive is just to remove mpasm warning... label found in colum 1... really annoying stuff.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. PBP is driving me crazy trying to make an 18F chip blink
    By George in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th June 2008, 06:08
  2. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43
  3. Code check -- button not working
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd March 2006, 22:43
  4. push button problem
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd June 2005, 19:44
  5. Button problem.
    By Modena in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th November 2004, 16:43

Members who have read this thread : 0

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