PIC16F684 GPIO puzzles me


Closed Thread
Results 1 to 3 of 3
  1. #1
    rrupad's Avatar
    rrupad Guest

    Default PIC16F684 GPIO puzzles me

    The PIC GPIO puzzles me.

    My requirement is to light up LEDs one after another with a slight delay and at the end of it all the LEDs need to glow.

    Below is the code that I wrote.

    void initPorts()
    {
    PORTA = 0X00;
    TRISA = 0X00;

    PORTC = 0x00;
    CMCON0 = 0X07;
    TRISC = 0x00;
    }

    void main()
    {
    initPorts();

    while(1)
    {
    RC5 = HI; __delay_ms(50);
    RC4 = HI; __delay_ms(50);
    RC3 = HI; __delay_ms(50);
    RC2 = HI; __delay_ms(50);
    RC1 = HI; __delay_ms(50);
    RC0 = HI; __delay_ms(50);
    }
    }

    When I execute this code on the target - LEDs on Port RC4 and RC5 glow continuously and the LEDs connected to the remaining ports sequentially switch on and off creating a running light effect.

    What am I doing wrong??

    Thanks for any response.

    Ravi Upadhyaya

  2. #2
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: PIC16F684 GPIO puzzles me

    This forum is for the PICBASIC compiler.

    Your code appears to be a variant of "C" rather than BASIC

    You may need to look elsewhere.

    sorry
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: PIC16F684 GPIO puzzles me

    "Wrong" language ;-)
    But try enabling digital I/O on PortC, look at the ANSEL register.

    /Henrik.

Similar Threads

  1. 12f675 GPIO Problem. No output on GPIO.2
    By tasmod in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd June 2014, 15:57
  2. 12F683: I change GPIO.5 but GPIO.0 also changes...why?
    By chicowoodhill in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th December 2012, 17:09
  3. Replies: 1
    Last Post: - 29th February 2012, 09:37
  4. PIC16F684 equivalent with 3 ports???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th May 2008, 10:44

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