directive in pbp to select pic



THE BOOK of DT's INTERRUPTS is an organization of interrupt service routines and other works written by Darrel Taylor, RIP.

Interrupt routines are arranged per Darrel's original list. Darrel Taylor's Instant Interrupts are an extension of the work of Tim Box whom in October of 2002 wrote INT_CTRL.pbp

Many of the forum members felt this is a long overdue project.

THE BOOK of DT's INTERRUPTS
will be a valuable resource and a tribute to Darrel Taylor the "Fanatical Contributor".

THE BOOK of DT's INTERRUPTS is located at http://dt.picbasic.co.uk/

+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2022
    Posts
    15

    Question directive in pbp to select pic

    friends greetings


    friends make a code in PBP, I have looked in the notepad of the pic 16f886.inc of the PBP and I have configured the fuses for the pic 16f886.
    #CONFIG
    __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_ON & _CPD_ON
    #ENDCONFIG


    define osc 8


    what I can't find is the directive to tell the compiler which pic to use, in this case pic 16f886.


    I know that by default the pbp assigns the default configuration and uses a 4 Mhz crystal, in my case I configured the fuses for the 16f886 pic and I defined the crystal to use in this case an 8 Mhz oscillator.
    but the only thing I need is to define the pic 16f886 in the pbp.
    Could you please help me and tell me what is the pbp directive to define the pic to use in the compiler.


    thanks friends

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,274


    Did you find this post helpful? Yes | No

    Default Re: directive in pbp to select pic

    Why don't you use the free MCS IDE?

  3. #3
    Join Date
    Jul 2022
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: directive in pbp to select pic

    do you mean msc ide bascom avr?

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,421


    Did you find this post helpful? Yes | No

    Default Re: directive in pbp to select pic

    Which device the compiler builds the code for is specified using the -p option passed to the compiler exectuable. There is, as far as I know, no way to specify that in the source code itself. See section 8.3 in the manual.

    If you use MicroCodeStudio it will handle this for you, generating the correct command line parameters based on the selected device and other options.

    Tip: define osc 8 won't work, osc needs to be in upper case:
    Code:
    define OSC 8

  5. #5
    Join Date
    Jul 2022
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: directive in pbp to select pic

    I correct DEFINE OSC 8 this should be in uppercase, I have read the manual again page 281 section 8.1.3.
    in section 4.9 page 100 of the manual I found the following

    #CONFIG...#ENDCONFIG
    #CONFIG
    ;configuration directives in Assembly Language
    #ENDCONFIG
    #CONFIG can be used to insert a block of Assembly Language directives that specify
    settings for target device's configuration words. These settings control things like the
    oscillator type, code protection, and other parameters that must be set before the
    program code executes. For detailed information about configuration words, see the
    datasheet for the specific PIC microcontroller that you are compiling for. Most
    datasheets will list the information in a section named "Configuration" or "Special
    Features".
    The #CONFIG block is similar to the ASM..ENDASM and @ runtime commands
    because its contents are written in Assembly Language. It is a special case,
    however, and differs from the runtime commands in significant ways. The code
    enclosed in a #CONFIG block always replaces the default configuration settings that
    PBP would normally include. The code is placed in a special location in the
    generated Assembly Language. This location is reserved for configuration directives;
    therefore #CONFIG should not be used for other Assembly instructions.
    Microchip determines the form and syntax of the actual configuration directives, and
    they are not consistent for different families of PIC microcontrollers. We have
    attempted to include the information for each chip in a device information file. The
    files are located in your PBP install in the Device Reference folder.
    (PIC16F877.INFO, PIC18F4620.INFO, etc.)
    Here are a few examples that you might use for various parts:
    'Config for 16F877A
    #CONFIG
    __config _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
    #ENDCONFIG
    'Config for 18F46J50
    #CONFIG
    CONFIG XINST = OFF
    CONFIG PLLDIV = 5
    CONFIG WDTPS = 512
    CONFIG CPUDIV = OSC1
    CONFIG OSC = HSPLL
    #ENDCONFIG

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,274


    Did you find this post helpful? Yes | No

    Default Re: directive in pbp to select pic

    And still there is no way to direct the use of specific PIC in the #config block.

    Use the MCS IDE that came with your purchase of PBP. Is the easiest solution.

    Ioannis

    Name:  Capture.PNG
Views: 44
Size:  47.3 KB

  7. #7
    Join Date
    Jul 2022
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: directive in pbp to select pic

    In the pbp manual page 100 section 4.9 it says the following.

    'Config for 16F877A
    #CONFIG
    __config _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
    #ENDCONFIG

    If the pic to use and the fuses are not specified, the pbp defaults to 4 mhz.
    Attached Images Attached Images  

  8. #8
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    498


    Did you find this post helpful? Yes | No

    Default Re: directive in pbp to select pic

    You have "include fp2032.bas" which doesn't look right. It should be "include pic16f886.bas" (or whatever your PIC is).

  9. #9
    Join Date
    Jul 2022
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: directive in pbp to select pic

    Quote Originally Posted by mpgmike View Post
    You have "include fp2032.bas" which doesn't look right. It should be "include pic16f886.bas" (or whatever your PIC is).
    fp2032.bas library is included for floating point.
    I also took into account the .inc file of each pic of the pbp to configure the fuses of the selected pic.
    I had to read the pbp manual page 100 section 4.9 to configure the fuses of the selected pic, read the pbp manual and you will see

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,274


    Did you find this post helpful? Yes | No

    Default Re: directive in pbp to select pic

    Quote Originally Posted by josepic View Post
    If the pic to use and the fuses are not specified, the pbp defaults to 4 mhz.

    That is correct. Not a problem but the default state of the compiler.

    Ioannis

Similar Threads

  1. Error 238 Preprocessor Directive Expected ???
    By MOUNTAIN747 in forum General
    Replies: 1
    Last Post: - 29th December 2011, 19:07
  2. Help converting __CONFIG directive to CONFIG
    By lilimike in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 7th December 2011, 19:05
  3. Org directive.?
    By Ruben Pena in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd June 2009, 22:19
  4. 12F675 MCLR directive MPASM
    By OLDSCHOOL in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th May 2008, 01:29
  5. CONFIG directive warning help
    By josegamez in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th August 2006, 20:02

Posting Permissions

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