PIC16F767 IOs


Closed Thread
Results 1 to 13 of 13

Thread: PIC16F767 IOs

  1. #1

    Default PIC16F767 IOs

    Hi all,
    I’m using PBP 2.45 and PIC16F767
    I have plenty of PIC16F767 on hand and my new project asks for lots of digital IOs .
    I need to make sure all the IOs are in digital mode.
    Reading the data sheet I got a little confused.
    Is it enough to get all IOs as digital using the generic lines:

    CMCON = 7 for analog comparators and
    ADCON1 = 7 for A/D IOs ?

    Do I need to change this lines or add some more?
    Any input will be appreciated.
    Nick

  2. #2
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Adcon1

    As I understand it, you should do adcon1=7 to make all analog pins digital. Thats how I do it. ports a and e are both affected by adcon1 reg and adcon1 = 7 will make port a digital so it should make both digital.

    Travin

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Thanks Travin.
    So, I should be safe using ADCON1=7 annd no strange behavior from the analog IOs?
    Regards,
    Nick

  4. #4
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Maybe

    Pin a.4 is an open drain. Read page 11 in the PBP manual if you intend on using that pin as an output.

    Travin

  5. #5


    Did you find this post helpful? Yes | No

    Default

    I'm using this code and I do not get any action from Pin 7 (RA5).
    I know about Pin 6 (RA4 open collector output)

    ADCON1=7
    CMCON=7

    main:


    Toggle PORTA.0
    Pause 300
    Toggle PORTA.1
    Pause 300
    Toggle PORTA.2
    Pause 300
    Toggle PORTA.3
    Pause 300
    Toggle PORTA.4
    Pause 300
    Toggle PORTA.5
    GoTo main
    End
    Am I missing something?
    Regards,

    Nick

  6. #6
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Code

    Is that your entire code. You might want to try and establish a know condition of the pins at the beggining. What osc are you using?

    cmcon=7
    adcon1=7

    trisa = %00000000 ' makes them outputs
    porta = %11111111 ' makes them high

    main:
    Toggle PORTA.0
    Pause 300
    Toggle PORTA.1
    Pause 300
    Toggle PORTA.2
    Pause 300
    Toggle PORTA.3
    Pause 300
    Toggle PORTA.4
    Pause 300
    Toggle PORTA.5
    GoTo main
    End
    Last edited by Travin77; - 29th May 2006 at 01:10.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    The code is only for testing A port.
    Am I wrong assuming that ADCON1=7 takes care only of A0-3 ports?
    Should I extend it to ADCON1=15 or ADCON1=31 to cover higher bits?
    Regards,

    Nick

  8. #8
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Adcon1

    Adcon1 should set all of port a to digital. Is there a good conection on porta.5?

  9. #9


    Did you find this post helpful? Yes | No

    Default

    Yes, connection is good, it just does not toggle.
    I used ADCON1=15 and the port A5 works(?!?!?!?!).
    With ADCON1=7 it does not work.
    All other A ports work in both cases.
    What about CVRCON register?

    Nick

  10. #10
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Cool

    Unfortunately, you are beyond my knowledge level. I am a semi-newbie. I read the datasheet and noticed that some of port b has a/d capabilities. That is probally why the adcon1 = 15 worked. Sorry for the bad gouge.

    travin
    Last edited by Travin77; - 29th May 2006 at 03:41.

  11. #11


    Did you find this post helpful? Yes | No

    Default

    Thanks again Travin!
    Will any of "Big Guns" step in, please!
    Nick

  12. #12
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    The '767 is like the 18F26XX series. ADCON1 = 15 or %00001111 to turn all IOs digital.

  13. #13


    Did you find this post helpful? Yes | No

    Default

    Thanks Ron,
    You confirmed my suspicion.

    Nick

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 23:31
  2. 8+8 IOs controlled via sms
    By aratti in forum GSM
    Replies: 15
    Last Post: - 11th December 2008, 12:29
  3. PIC16F767 blinking code
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 16th October 2006, 15:25
  4. problem ont hpwm on the pic16f767!!
    By oscar in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th May 2005, 11:41

Members who have read this thread : 2

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