PORTA.5 not responding on 16F18346??
+ Reply to Thread
Results 1 to 4 of 4
  1. #1

    Default PORTA.5 not responding on 16F18346??

    Bizarre behavior that I cannot explain on the PIC16F18346... any suggestions would be more than welcome.

    Simply put, MYLED does NOT flash, but the output from the pin remains LOW.
    meanwhile, MYLED1 flashes like it's supposed to.

    STUMPED...

    Code:
    '   PORT/ADCON SETTINGS
    ADCON0=%00010001 'A/D control
    ADCON1=%11110000 '(RC conversion clock, right justified 10-bit result)
    '---------------------------------------------------------------
    PORTA=%00000000 'assign initial output values so they don't show up randomized
    TRISA=%011101   'assign DDRA (1=in, 0=out)
    ANSELA=%010000  'PA.4 analog mode
    'WPUA.3=1        'enable WPU on pushbutton input (later use)
    'WPUA.2=1        'enable WPU (later use)
    '---------------------------------------------------------------
    PORTB=%00000000 'assign initial output values so they don't show up randomized
    TRISB=%11100000 'assign DDRB (1=in, 0=out)
    ANSELB=%00000000 'all in digital mode
    'WPUB=%11000000   'WPU for future
    '---------------------------------------------------------------
    PORTC=%00000000
    TRISC=%00000000
    ANSELC=%00000000
    '*******************************************************************************
    '
    '   DEFINES
    define OSC 32
    DEFINE ADC_CLOCK 2 'use separate RC conversion clock
    DEFINE ADC_BITS 10 ' Set number of bits in result
    DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS
    define WRITE_INT 1
    'the following must be used for this chip to disable default settings (for PWM enabled)
    DEFINE CCP1_REG 0   'channel-1 unused
    DEFINE CCP1_BIT 0   'channel-1 unused
    DEFINE CCP2_REG PORTC   'channel 2 port
    DEFINE CCP2_BIT 3       'channel 2 bit (C3) used later
    DEFINE CPP3_REG 0   'channel 3 unused
    DEFINE CPP3_BIT 0   'channel 3 unused
    DEFINE CCP4_REG 0   'channel 4 unused
    DEFINE CCP4_BIT 0   'channel 4 unused
    '*******************************************************************************
    '
    '   VARIABLES / ALIASES
    MYLED var PORTA.5 'pin 2
    MYLED1 VAR PORTA.1 'pin 18
    '*******************************************************************************
    '
    '   MAIN PROGRAM
    main:
    pause 1000
    MYLED=~MYLED
    MYLED1=~MYLED1
    goto main
    
    end

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,205

    Default Re: PORTA.5 not responding on 16F18346??

    PORTA.5 is "CLKIN OSC1"pin, depending on config and osc settings on OSCCON1, OSCCON2, and OSCCON3.

    There seems to be no OSCCONx in your code.

    You need to make sure that the osc stays internal.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3

    Default Re: PORTA.5 not responding on 16F18346??

    Thanks - after reviewing, I think I may have left part of the configuration word at its default value instead of turning EXTERNAL OSC *OFF*.

    Will test and report back.

  4. #4

    Default Re: PORTA.5 not responding on 16F18346??

    Quote Originally Posted by picster View Post
    Thanks - after reviewing, I think I may have left part of the configuration word at its default value instead of turning EXTERNAL OSC *OFF*.

    Will test and report back.
    YUP it wasn't OSCCONx per se, but you got me thinking and it WAS the Configuration Word Settings. I had (erroneously) assumed that by setting INTOSC at 32MHz, no other config word settings would be needed regarding osc, but NOPE, there's another setting you need to set to "OFF" to kill the secondary oscillator association with pins.

    Thanks sayzer!

Similar Threads

  1. Second I2C address not responding
    By Amoque in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 18th October 2013, 06:27
  2. 18f4550 ADC not responding
    By celequanta in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th March 2012, 12:26
  3. PORTC.4 and C.5 not responding to inputs.
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd February 2012, 21:41
  4. PIC stop responding - Strange Problem!
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 31st August 2009, 14:06
  5. Pic 18f252 not responding
    By gringo332 in forum General
    Replies: 5
    Last Post: - 22nd March 2007, 21:21

Members who have read this thread : 14

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

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