Normal i/o required on portc , pin6, 7 18f27k40


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838

    Default Normal i/o required on portc , pin6, 7 18f27k40

    Hi guys , wondering if anyone has config set the normal port c i/o pins 6, 7 for the 18f27k40 , as it appears to not respond ,

    the portc pins 6,7 can be used as Usart1 , but i require it to be standard i/o


    here what i have that effects port c


    Code:
      '  -------   Port C Settings & directions  ----------
        ANSELC  = %00000000          ' Set Port C Analog bit7-0 = ANC7-0 / 0 = digital ,1= Analog   
        TRISC   = %00000100          ' 1= Digital Input / 0= Digital Outputs  ANC7 = spare_tx1 output when IR-TX
        IOCCN   = %00000000          ' IOC Negative Edge Trigger Select RC7-RC0  0 = diabled 1 = enabled POR = 0
        WPUC    = %00000000          ' Set Week Pullups on Digital inputs POR =0  
        INLVLC  = %11111111          ' Set Input levels - Schmitt = 1 / TTL = 0  POR = 1 
        SLRCONC = %11111111          ' Set Slew Rate 1 = Rate Limited  0 = Max rate POR =1 
        IOCCP   = %00000000          ' IOC Positive Edge Trigger Select RC7-RC0  0 = diabled 1 = enabled POR = 0
        ODCONC  = %00000000          ' Open Drain 0 = Output drives both High and Low signals  1= Output drives Low going signals only POR = 0
        
    
       PMD4 = %01111111	'Bit7= UART2, Bit6= UART1, Bit5= MSSP2 , Bit4=MSSP1,Bit3-1 =N/A , Bit0= CWG1 ( Comparitor Output shutdown )

  2. #2
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Normal i/o required on portc , pin6, 7 18f27k40

    Code:
     PPSLOCK    =   $55                 ;PPS Unlock Sequence
     PPSLOCK    =   $AA
     PPSLOCK    =   0
    RC6PPS = 0
    RC7PPS = 0
     PPSLOCK    =   $55                 ;PPS Lock Sequence
     PPSLOCK    =   $AA
     PPSLOCK    =   1

  3. #3
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Normal i/o required on portc , pin6, 7 18f27k40

    thanks mike ill give that ago ,


    i have not locked down pps at any point so i should not need to unlock it , from what i currenlty understand of the k40 series

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Normal i/o required on portc , pin6, 7 18f27k40

    That is right Sheldon, But you do initially have to unlock the PPS register. It's up to you to lock it after or as I do, leave it unlocked so as to make later changes to it.
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: Normal i/o required on portc , pin6, 7 18f27k40

    You shouldn't have to make any changes to the PPS registers or the PPSLOCK unless you've done something to change them.

    The PPSLOCK powers up as unlocked, and the PORT pins default to the PORT data latch (no PPS in effect at reset).

    PORTC should work after setting up the TRISC and ANSELC registers.

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Normal i/o required on portc , pin6, 7 18f27k40

    Yes Sheldon, Tumbleweed is right, as long as " CONFIG PPS1WAY = OFF " is set in this way at processor configuration. All "RxyPPS pins default to the "LATxy" upon "POR". However peripherals inputs default to the states listed in section 17.1 of the data sheet.
    Dave Purola,
    N8NTA
    EN82fn

  7. #7
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Normal i/o required on portc , pin6, 7 18f27k40

    yes i checked that the lat registers were contiguous so use the offset works fine

    i am thinking that the devices that use bi direction pins such as usarts , need the PPS set to be off if those services are not in use ,

    it not harm anything if i set all pins not requiring a pps service to 0 as it clear makes them i/o use regardless

  8. #8
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Normal i/o required on portc , pin6, 7 18f27k40

    another thing to note on the 2xk40 ,4xK40 , is that usart 2 default pins share the ISCP pins

    although notes on PBP3.1.1 for the k40 indicate a possible ISCP lockout can occur , i have not had this happen

    what i have found is that while programing using iscp , with the terminal port connected , which also provides alt power to my device , the device driver for the usb to ttl chip can occasionally hang the pc while the ISCP is programing

    so i would recommend allocating other pins for usart2 when designing with k40 , if you ever need the ISCP port ,

    the k40 PPS port make it nice to do this

    charles recommends in the notes
    RX2 = RB5 on 2xk40, 4x40
    TX2 = RB4 on 2xk40 , 4xk40

    DEFINE HSER2_RXREG PORTB
    DEFINE HSER2_RXBIT 5
    DEFINE HSER2_TXREG PORTB
    DEFINE HSER2_TXBIT 4



    cheers

    Sheldon
    Last edited by longpole001; - 29th July 2018 at 03:31.

  9. #9
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Normal i/o required on portc , pin6, 7 18f27k40

    Sheldon, If you look at the date sheet page 229 you will see that the default pin selection's for USART2 input is on port B.7. I have never in the past 2 or so years had any problem with LOCKOUT of the ICSP. I always use the 2 USART hardware serial ports for my projects. I only have to set the Output PPS port pins for the 2 hardware USART's. I use RC6PPS = 09 and RB6PPS = 0B. I always use a BootLoader as well.
    Dave Purola,
    N8NTA
    EN82fn

  10. #10
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Normal i/o required on portc , pin6, 7 18f27k40

    i will later this coming month start to try and get a bootloader working for the 27k40 , as i really like to get away from iscp programing of chips

Similar Threads

  1. Replies: 10
    Last Post: - 26th July 2018, 04:14
  2. 18f27k40 - adc settings
    By longpole001 in forum PBP3
    Replies: 5
    Last Post: - 12th July 2018, 11:34
  3. 18f4550 portc.4 and portc.5 problem
    By pcaccia in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th October 2008, 20:52
  4. 16f877 portc.6 & portc.7
    By DavyJones in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 12th January 2008, 04:38
  5. HOW do you initialize PortC to normal I/O??
    By Len in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th June 2005, 18:56

Members who have read this thread : 1

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