Can anyone help at getting OWIn & OWOut to work @ 16MHz?


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    jessey's Avatar
    jessey Guest


    Did you find this post helpful? Yes | No

    Default Here are the fuse settings that I copied & pasted into my program

    Hi Bruce,

    I'm not using my Labx experimenters board for this one, I have it bread boarded. One more thing I noticed is that when I first copied and pasted the code from my inc file into my program is that only 7 of them would compile. Then I started moving them around and when I placed the CONFIG2H statement above the CONFIG2L statement then they both compiled....... strange? This is what I pasted into my code below to configure my fuse settings:

    '@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _RCIO_OSC_1H; This dosen't compile
    ;Configuration Byte 1H Options
    '_OSCS_ON_1H EQU H'DF' ; Oscillator Switch enable
    '_OSCS_OFF_1H EQU H'FF'
    '_LP_OSC_1H EQU H'F8' ; Oscillator type
    '_XT_OSC_1H EQU H'F9'
    '_HS_OSC_1H EQU H'FA'
    '_RC_OSC_1H EQU H'FB'
    '_EC_OSC_1H EQU H'FC' ; External Clock w/OSC2 output divide by 4
    '_ECIO_OSC_1H EQU H'FD' ; w/OSC2 as an IO pin (RA6)
    '_HSPLL_OSC_1H EQU H'FE' ; HS PLL
    '_RCIO_OSC_1H EQU H'FF' ; RC w/OSC2 as an IO pin (RA6)

    @ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H; this one was below 2L code
    ;Configuration Byte 2H Options
    '_WDT_ON_2H EQU H'FF' ; Watch Dog Timer enable
    '_WDT_OFF_2H EQU H'FE'
    '_WDTPS_128_2H EQU H'FF' ; Watch Dog Timer PostScaler count
    '_WDTPS_64_2H EQU H'FD'
    '_WDTPS_32_2H EQU H'FB'
    '_WDTPS_16_2H EQU H'F9'
    '_WDTPS_8_2H EQU H'F7'
    '_WDTPS_4_2H EQU H'F5'
    '_WDTPS_2_2H EQU H'F3'
    '_WDTPS_1_2H EQU H'F1'

    ' was ON was OFF
    @ __CONFIG _CONFIG2L, _BOR_OFF_2L & _BORV_20_2L & _PWRT_ON_2L
    ;Configuration Byte 2L Options
    '_BOR_ON_2L EQU H'FF' ; Brown-Out Reset enable
    '_BOR_OFF_2L EQU H'FD'
    '_PWRT_OFF_2L EQU H'FF' ; Power-Up Timer enable
    '_PWRT_ON_2L EQU H'FE'
    '_BORV_20_2L EQU H'FF' ; BOR Voltage - 2.0v
    '_BORV_27_2L EQU H'FB' ; 2.7v
    '_BORV_42_2L EQU H'F7' ; 4.2v
    '_BORV_45_2L EQU H'F3' ; 4.5v

    '@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H; This dosen't compile here
    ';Configuration Byte 2H Options but compiles above 2L
    ''_WDT_ON_2H EQU H'FF' ; Watch Dog Timer enable
    ''_WDT_OFF_2H EQU H'FE'
    ''_WDTPS_128_2H EQU H'FF' ; Watch Dog Timer PostScaler count
    ''_WDTPS_64_2H EQU H'FD'
    ''_WDTPS_32_2H EQU H'FB'
    ''_WDTPS_16_2H EQU H'F9'
    ''_WDTPS_8_2H EQU H'F7'
    ''_WDTPS_4_2H EQU H'F5'
    ''_WDTPS_2_2H EQU H'F3'
    ''_WDTPS_1_2H EQU H'F1'

    ' was ON
    @ __CONFIG _CONFIG3H, _CCP2MX_OFF_3H
    ;Configuration Byte 3H Options
    '_CCP2MX_ON_3H EQU H'FF' ; CCP2 pin Mux enable
    '_CCP2MX_OFF_3H EQU H'FE'

    '' This dosen't compile below
    '@ __CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
    ';Configuration Byte 4L Options
    ''_STVR_ON_4L EQU H'FF' ; Stack over/underflow Reset enable
    ''_STVR_OFF_4L EQU H'FE'
    ''_LVP_ON_4L EQU H'FF' ; Low-voltage ICSP enable
    ''_LVP_OFF_4L EQU H'FB'
    ''_DEBUG_ON_4L EQU H'7F' ; Backgound Debugger enable
    ''_DEBUG_OFF_4L EQU H'FF'

    @ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
    ;Configuration Byte 5L Options
    '_CP0_ON_5L EQU H'FE' ; Code protect user block enable
    '_CP0_OFF_5L EQU H'FF'
    '_CP1_ON_5L EQU H'FD'
    '_CP1_OFF_5L EQU H'FF'
    '_CP2_ON_5L EQU H'FB'
    '_CP2_OFF_5L EQU H'FF'
    '_CP3_ON_5L EQU H'F7'
    '_CP3_OFF_5L EQU H'FF'

    ' was ON
    @ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
    ;Configuration Byte 5H Options
    '_CPB_ON_5H EQU H'BF' ; Code protect boot block enable
    '_CPB_OFF_5H EQU H'FF'
    '_CPD_ON_5H EQU H'7F' ; Code protect Data EE enable
    '_CPD_OFF_5H EQU H'FF'

    @ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
    ;Configuration Byte 6L Options
    '_WRT0_ON_6L EQU H'FE' ; Write protect user block enable
    '_WRT0_OFF_6L EQU H'FF'
    '_WRT1_ON_6L EQU H'FD'
    '_WRT1_OFF_6L EQU H'FF'
    '_WRT2_ON_6L EQU H'FB'
    '_WRT2_OFF_6L EQU H'FF'
    '_WRT3_ON_6L EQU H'F7'
    '_WRT3_OFF_6L EQU H'FF'

    @ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
    ;Configuration Byte 6H Options
    '_WRTC_ON_6H EQU H'DF' ; Write protect CONFIG regs enable
    '_WRTC_OFF_6H EQU H'FF'
    '_WRTB_ON_6H EQU H'BF' ; Write protect boot block enable
    '_WRTB_OFF_6H EQU H'FF'
    '_WRTD_ON_6H EQU H'7F' ; Write protect Data EE enable
    '_WRTD_OFF_6H EQU H'FF'

    @ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
    ;Configuration Byte 7L Options
    '_EBTR0_ON_7L EQU H'FE' ; Table Read protect user block enable
    '_EBTR0_OFF_7L EQU H'FF'
    '_EBTR1_ON_7L EQU H'FD'
    '_EBTR1_OFF_7L EQU H'FF'
    '_EBTR2_ON_7L EQU H'FB'
    '_EBTR2_OFF_7L EQU H'FF'
    '_EBTR3_ON_7L EQU H'F7'
    '_EBTR3_OFF_7L EQU H'FF'

    @ __CONFIG _CONFIG7H, _EBTRB_OFF_7H
    ;Configuration Byte 7H Options
    '_EBTRB_ON_7H EQU H'BF' ; Table Read protect boot block enable
    '_EBTRB_OFF_7H EQU H'FF'

    And with the two CONFIG1H & CONFIG4L sections commented out, it compiles ok and I can use them.

    Thanks
    jessey

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi jessey,

    Sorry. P18F452.INC is the "Microchip" include file. Open the 18F452.INC file "in your PBP directory". Make the change to this one. Not the one located in your MPLAB directory.

    PBP has a device specific header file for each PIC it supports. These header files contain default config fuse settings for each device.

    This is the file you edit. Not the Microchip header file.

    Yes. You can make changes to over-ride config fuse settings embedded in the final .hex file with your EPIC software, however, it may not always work like you might expect.

    Example. You compile your code using the default config fuse settings in the "18F452.INC" file in your "PBP" directory. You launch the EPIC software from within MCS, and you make changes to the config fuse settings with your EPIC software.

    Now you click program, and it stil uses the default settings from the .hex file.

    What happened? If you have the "Reread file before programming", and "Update Configuration From File" options selected, it just reloads the .hex file "from disc" into memory, and dumps the default settings in.

    What most folks forget is to click the "Save" button after making changes to the config fuse settings to save them back to the .hex file on disc.

    MPASM does not like it when you have config fuse settings in your code & in the PBP 18F452.INC file. You can only have them in "1" location or it returns this error message.

    If you place the config fuse directive in your code, then you need to comment them all out in the PBP 18F452.INC header file.

    Change your Microchip P18F452.INC file back to its original state.

    Look in your "PBP" directory for 18F452.INC. Make only the change I mentioned previously, and see what you get.
    Last edited by Bruce; - 23rd January 2006 at 23:50.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    jessey's Avatar
    jessey Guest


    Did you find this post helpful? Yes | No

    Default I'm sure I'll get it now..........Thanks

    Many Thanks Bruce,

    We seem to be playing tag here but after reading your last post I found the proper .inc file in PBP, thanks for the clarifation. Cool.............

    NOLIST
    ifdef PM_USED
    LIST
    "Error: PM does not support this device. Use MPASM."
    NOLIST
    else
    LIST
    LIST p = 18F452, r = dec, w = -311, f = inhx32
    INCLUDE "P18F452.INC" ; MPASM Header
    __CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
    __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
    __CONFIG _CONFIG4L, _LVP_OFF_4L
    NOLIST
    endif
    LIST
    EEPROM_START EQU 0F00000h
    BLOCK_SIZE EQU 8

    And these are the 3 that I couldn't get to compile. It makes perfect sense now. Live and learn!! This list is great............

    Many Thanks Again
    jessey

  4. #4
    jessey's Avatar
    jessey Guest


    Did you find this post helpful? Yes | No

    Default Everything is working good now, thanks for your help.

    Hello Bruce,

    It worked like a charm. I commented out all 3 lines in the 18F452.INC file in PBP and now have all 11 of the @ __CONFIG fuse settings compiled into my program and have total control over all the settings within the program I'm writing. Now I can just cut and paste them into any future programs. And also, now my pause statements have the correct timing too so everything is working just great. Thanks again!

    Thanks
    jessey

  5. #5
    jessey's Avatar
    jessey Guest


    Did you find this post helpful? Yes | No

    Default Two Versions of MBASM?

    Hello Bruce,

    I just noticed that I have 2 copies of MPASM installed on my computer. The one that MicroCode Studio makes reference to in the PicBasic Options is addressed at C:\program files\mecanique\mcsp\mpasm and the other one is located @ C:\MPASM. The one that's accessed by MicroCode Studio is version v03.50 and the other one is v03.60. I'm not sure how that happened? Both versions have the identical .inc file for the 18f452, their both Standard Header File, Version 1.4. So the one I included as an attachment in my post here is the same. The newer version has a MIGRATE.INC & a P18MACRO.INC files that the v03.50 doesn't have so that's probably the reason for the PLL not working properly. I think I remember reading a couple of years ago in the archives in a post that you can fool PBP to run faster by defining a higher osc setting than the one your using or something like that and the end result was that you had to redo all your pause settings after fooling PBP. And when I ran into that problem I didn't think about it right, I should have looked for that post to confirm.

    I guess I should delete the v03.50 and keep the v03.60 then direct MicroCode Studio to use the newer version or maybe just download and install the newest version. When I tried commenting out the code for the fuse settings it was the file at the C:\MPASM location which wouldn't have had any effect at all? I feel like an idiot. But I'm still not sure which lines to comment out because they aren't the same as the one you pointed out to me in your last post or on any other posts that I've seen so far? Maybe the newer version will have the lines you suggested to comment out. What is the newest reliable version of MPASM that available for download? I've read that some guys regret upgrading to newer versions of MPASM for reasons I'm not familiar with.

    Anyways I'll check and see if I can find the newest version and try that to see how it works out or now that I know what's going on maybe I'll try modifying the proper .inc file. I'll get back to you with my results.

    Thanks for your help
    jessey

Similar Threads

  1. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  2. STATUS re-curtain W
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th February 2005, 15:21
  3. help
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th February 2005, 20:42
  4. Need once your help one please
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th February 2005, 20:33
  5. can i slowdown owin and owout
    By Eugen in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 29th January 2005, 22:17

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