RA6 & RA7 I/O setting on the 16F88


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Smile

    Hi guys, thanks for the responce!

    I have been doing a few projects based on the 16F88 and they all have turned out a success until this time, the first time I needed RA6 & RA7 as I/O’s.

    I use MPASAM and the first part of my code looks like this:

    define OSC 8

    OSCCON =%01110000

    @__config_INTRC_IO ‘ added today, compiled OK but no I/O on RA6 or RA7

    TRISB = %00000000

    TRISA = %11001100

    ANSEL = %00000000

    CMCON = 7



    All the other ports works just fine so.....


    Thanks for being here!

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    At least it compiles

    Try what skimask suggested
    INTRC_CLKOUT
    Or compile with PM and use
    @ DEVICE MCLR_OFF, INTRC_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_ON

    One of them has to work.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    This chip as 2 ADCON registers too
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Default

    I tried the “INTRC_CLKOUT” with MPASM it compiled well but still no I/O!
    I use the 16F88.inc file as is, not edited.

    There must be something I miss here; “INTRC_CLKOUT” does not make sense to me (no offence)! The “INTRC_IO” statement seems more logic to me, of curse I might be of the tracks here but that’s how I see it.

    Referring to the 16F88 datasheet page 130 way down;

    Bit 4, 1-0 FOSC<2:0>: Oscillator Selection bits.

    I believe what I need is the fourth alternative:

    “100 = INTRC oscillator; port I/O function on both RA6/OSC2/CLKO pin and RA7/OSC1/CLKI pin”.

    Or… am I loosing it? (apart from my hair!)



    Thanks guys!

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by PICante View Post
    I tried the “INTRC_CLKOUT” with MPASM it compiled well but still no I/O!
    I use the 16F88.inc file as is, not edited.
    Have you commented out the shebang line in the inc?
    http://www.picbasic.co.uk/forum/show...75&postcount=5
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Smile

    This is the last part of my untouched inc file:

    Code:
     ;==========================================================================
    ;
    ;       Configuration Bits
    ;
    ;==========================================================================
    
    _CONFIG1                     EQU     H'2007'
    _CONFIG2                     EQU     H'2008'
    
    
    ;Configuration Byte 1 Options
    _CP_ALL                      EQU     H'1FFF'
    _CP_OFF	                     EQU     H'3FFF'
    _CCP1_RB0		     EQU     H'3FFF'
    _CCP1_RB3                    EQU     H'2FFF'
    _DEBUG_OFF                   EQU     H'3FFF'
    _DEBUG_ON                    EQU     H'37FF'
    _WRT_PROTECT_OFF             EQU     H'3FFF'	;No program memory write protection
    _WRT_PROTECT_256             EQU     H'3DFF'	;First 256 program memory protected
    _WRT_PROTECT_2048            EQU     H'3BFF'	;First 2048 program memory protected
    _WRT_PROTECT_ALL             EQU     H'39FF'	;All of program memory protected
    _CPD_ON                      EQU     H'3EFF'
    _CPD_OFF                     EQU     H'3FFF'
    _LVP_ON                      EQU     H'3FFF'
    _LVP_OFF                     EQU     H'3F7F'
    _BODEN_ON                    EQU     H'3FFF'
    _BODEN_OFF                   EQU     H'3FBF'
    _MCLR_ON		     EQU     H'3FFF'
    _MCLR_OFF                    EQU     H'3FDF'
    _PWRTE_OFF                   EQU     H'3FFF'
    _PWRTE_ON                    EQU     H'3FF7'
    _WDT_ON                      EQU     H'3FFF'
    _WDT_OFF                     EQU     H'3FFB'
    _EXTRC_CLKOUT		     EQU     H'3FFF'
    _EXTRC_IO		     EQU     H'3FFE'
    _INTRC_CLKOUT                EQU     H'3FFD'
    _INTRC_IO		     EQU     H'3FFC'
    _EXTCLK			     EQU     H'3FEF'
    _HS_OSC                      EQU     H'3FEE'
    _XT_OSC                      EQU     H'3FED'
    _LP_OSC                      EQU     H'3FEC'
    
    
    ;Configuration Byte 2 Options
    _IESO_ON                     EQU     H'3FFF'
    _IESO_OFF                    EQU     H'3FFD'
    _FCMEN_ON                    EQU     H'3FFF'
    _FCMEN_OFF                   EQU     H'3FFE'
    
    
    
    ; To use the Configuration Bits, place the following lines in your source code
    ;  in the following format, and change the configuration value to the desired 
    ;  setting (such as CP_OFF to CP_ALL).  These are currently commented out here
    ;  and each __CONFIG line should have the preceding semicolon removed when
    ;  pasted into your source code.
    
    ;Program Configuration Register 1
    ;		__CONFIG    _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF  
    & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC
    
    ;Program Configuration Register 2
    ;		__CONFIG    _CONFIG2, _IESO_OFF & _FCMEN_OFF
    
    
    
            LIST

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by PICante View Post
    This is the last part of my untouched inc file:
    That is the inc file from MPASM, do not modify it. That is where you get info about the chip.

    The inc file you modify is in the PBP directory. It looks like this.
    Code:
           NOLIST
        ifdef PM_USED
            LIST
            include 'M16F88.INC'	; PM header
     ;       device  pic16F88, hs_osc, wdt_on, lvp_off, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 16F88, r = dec, w = -302
            INCLUDE "P16F88.INC"	; MPASM  Header
      ;      __config _CONFIG1,_INTRC_IO& _WDT_ON & _LVP_OFF & _CP_OFF
            NOLIST
        endif
            LIST
    Notice the ';' That is a comment for this type of file. The two lines between LIST and LIST with comments are the lines to change or if setting the fuses in code space comment out.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Unhappy

    Thanks for your patience Dave!

    Well, I commented out the two lines as you suggested recompiled and put the code into the PIC and it froze! Tried a few times and also tried to reset the PIC but noting, stone cold! I opened the inc file, restored it, recompiled the code and it was all back to normal.
    I must have my stupid hat on this week, this thing just won’t fly!

Similar Threads

  1. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 15:01
  2. Setting I/O ports on 16f629
    By Optech in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2008, 22:51
  3. 16F88 RA6 and RA7 troubles
    By gandora in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 3rd August 2007, 03:57
  4. 16F88 - CCPMX strange fuse setting for HWPM
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 5th April 2007, 23:33
  5. Making RA6 (OSC2) an output on a 18F2525
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th September 2006, 18:51

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