Menu

PORTA.3 not working on 16F17115

2025-05-04
2025-05-04
  • Roger Jönsson

    Roger Jönsson - 2025-05-04

    Hi,

    PORTA.3 / ANA3 on 16F17115 returns mostly noise, like not being properly connected. (ANA0, ANA1 and ANA2 works).

    I can't get PORTA.3 to output anything either. Pin4 (/MCLR/Vpp/RA3) just floats like not connected.
    (A simple blinky-test works on A.2 but not on A.3. )

    GCStudio 1.76.2

    #Chip 16F17115, 16
    #Option Explicit
    #include <glcd.h>
    
    #DEFINE GLCD_TYPE         GLCD_TYPE_SSD1306_64x32 
    #DEFINE GLCD_I2C_Address  0x78 
    
    // Define I2C Software settings
      #DEFINE I2C_MODE Master
      #DEFINE I2C_DATA    PORTA.4
      #DEFINE I2C_CLOCK   PORTA.5
      #DEFINE I2C_DISABLE_INTERRUPTS ON
    
    DIR PortA.0 IN : DIR PortA.1 IN : DIR PortA.2 IN : DIR PortA.3 IN 
    
    Do
      GLCDPrint ( 0, 0, leftpad(str(ReadAD(ANA0)),3)) 
      GLCDPrint ( 32, 0, leftpad(str(ReadAD(ANA1)),3)) 
      GLCDPrint ( 0, 20, leftpad(str(ReadAD(ANA2)),3)) 
      GLCDPrint ( 32, 20, leftpad(str(ReadAD(ANA3)),3)) 
    Loop
    
     
    • Anobium

      Anobium - 2025-05-04

      ANA3 is on MCLRE and therefore not operating.

      The datasheet shows PCH[5:0] ADC Positive Input Channel Selection

      RA5
      RA4
      RA2
      RA1
      RA0

      Unfortunately GCBASIC does not have detailed map of each of the ADC ports and therefore ANA3 on this microcontroller is accepted. I will we had the resources to resolve this.

      So, ANA3 is not valid.

       
  • Roger Jönsson

    Roger Jönsson - 2025-05-04
    1. I see, I failed to find that info in the datasheet.. - Is that always the case, that if the ADC is on MCLRE it will not be operational?
    2. What about using this pin as an output? Same thing, = no?
     

    Last edit: Roger Jönsson 2025-05-04
  • Anobium

    Anobium - 2025-05-04
    1. From my experience - yes
    2. It is an input. I did read, many years ago, of adding additional hardware to make it operate 'like' an output.

    Use an external ADC?

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-04

    Thank you!
    I can move things around and manage without that pin. I just got puzzled.
    I now tried searching "RA3" and it brings up the info that I previously failed to find. I could also have searched for ANA2 to find the info. Searching for ANA3, which I did, ofcourse yeilded nothing since it doesn't exist. Sigh.
    I now learned that. (slightly embarrassed).

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.