16f877 portc.6 & portc.7


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113

    Question 16f877 portc.6 & portc.7

    hello all. I've got a question I hope will give me the answer I am looking for. Is there anyway to initialize portc.6 and portc.7 on the 877 to use as simple outputs to light a couple led's? I'm hoping I won't have to etch another board. I know I should have looked before I did that but I didn't now I'm stuck. trisc = %0000000 seems to initialize the first 6 portc.0 through portc.5 and I can trigger those to light led's but 6 and 7 won't. I'm sure it's because they are typically used for txd and rxd. I'm hoping there is a way.
    Thanks in advance
    David

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


    Did you find this post helpful? Yes | No

    Default

    trisc = %0000000

    Should do it. What else is in your code?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Post My current code for testing purposes.

    Thanks for the response.
    I wrote this little test after I realized I used those pins. When this is running led's 0 through 5 will turn on for .5 seconds then go off. but 6 and 7 stay off.

    Define ONINT_USED 1
    i var byte ' Define loop variable
    TRISC = %00000000 ' Set PORTD to all output
    FOR I = 0 TO 7
    PORTC.0[I]=1
    NEXT I
    LOOP: Pause 1000
    For i = 0 to 7 ' Go through For..Next loop 7 times
    PORTC.0[I] = 0
    Pause 500
    PORTC.0[I] = 1 ' Delay for .5 seconds
    Next i
    Goto loop ' Go back to loop and blink LED forever
    End

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


    Did you find this post helpful? Yes | No

    Default

    Well I do not see the problem.

    Try this and see what happens.

    Code:
    LOOP:
    HIGH PORTC.6
    HIGH PORTC.7
    PAUSE 100
    LOW PORTC.6
    LOW PORTC.7
    PAUSE 100
    GOTO LOOP
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Still nothing

    mackrackit thanks for the assistance

    I tried the HIGH PORTC.6 and LOW PORTC.6 loop and still nothing the led's remain off. I don't need to have an pull up or pull down resisitors on those pins do I?

    Thanks
    David

  6. #6
    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 DavyJones View Post
    need to have an pull up or pull down resisitors on those pins do I?
    No, the LED with its resistor takes care of that.
    Now I have to ask the ...
    Are you sure you are using the correct pins?
    Have you checked the LEDs?
    and so on...

    With TRISC set for out or in, these to pins act as far as I know like any other, The TX/RX has to be defined.

    Can you post you layout(schematic or picture)?
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. 16f877 and ps/2 keyboard error???
    By boraciner in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th July 2009, 08:14
  2. Help SERIN2/SEROUT2
    By mike20200 in forum mel PIC BASIC
    Replies: 3
    Last Post: - 5th September 2007, 06:19
  3. serial communication between CMUcam and PIC 16F877
    By gengkeys in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th March 2007, 06:43
  4. 4 Quadrant dc drive with 16F877
    By mns45 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 23rd February 2006, 13:05
  5. problem using 16f877
    By yrch in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th February 2006, 18:58

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