One LED not light up


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Jul 2013
    Location
    Malaysia
    Posts
    1

    Default One LED not light up

    hi all,
    i trying to make a running light LED on dsPIC33FJ64MC802 and this is my code

    Code:
    void main (void){
        TRISA=0x0000; //portA as output
        unsigned int data;
        unsigned int n;
        unsigned int m;
        while (1){
             data=0x01;
            for(n=0;n<5;n++){  //make a loop for led to on
                LATA=data;    //to confugure which led to on
                data=data<<1;  //change the value in data
                delay1s();      
            }
            data=0x10;          //Change value in data to make led light on backwork
            for(m=0;m<5;m++){    //make a loop for led to on
                LATA=data;     //to confugure which led to on
                data=data>>1;   //change the value in data
                delay1s();        
            }
        }
    }
    my question is, why my LED 4 not light up while other run as what i want.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,116


    Did you find this post helpful? Yes | No

    Default Re: One LED not light up

    1. This is a PicBasic Forum and not C.
    2. The above compiler does not support 24 or 32 series PICs.
    3. Maybe your PortA is input only, so check your PICs datasheet.

    Ioannis

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: One LED not light up

    Very likely porta for led 4 is an open collector port. In such a case, you just need to change the way the led is connected.
    (Check the data sheet for confirmation)

    Cheers

    Al.
    All progress began with an idea

Similar Threads

  1. PIC16F1825 unable to Light an LED
    By Lestat in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th March 2013, 18:38
  2. sweeping LED light effect
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th July 2012, 06:04
  3. LED Light Sensor - Need Help Please
    By Heckler in forum General
    Replies: 10
    Last Post: - 22nd January 2012, 04:53
  4. LED Light Controller
    By lightwaveengine in forum mel PIC BASIC
    Replies: 0
    Last Post: - 18th June 2006, 15:46
  5. An LED as a light Sensor
    By Funky Gibbon in forum General
    Replies: 12
    Last Post: - 10th April 2006, 18:43

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