Electronic Circuits and Projects Forum


Programming help

Results 1 to 5 of 5
Reply to Thread
  1. #1
    jimmyvarghese143
    jimmyvarghese143 is offline

    Default Programming help

    hi everybody i want display 0-100 in my development kit.here is my program that wil display fomm 0-9.so please give me some suggection for making the changes.




    #include<pic.h>
    #include<stdio.h>


    void main()

    {
    int i;
    char map[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6 F};
    TRISD=0x00; // for diplay/led output
    TRISC=0x00; // latch control
    TRISB=0X00; // display control
    RC1=0;
    RC0=0;
    i=0;

    while(i<9)
    {

    i++;
    PORTD=map[i]; //masking the values
    PORTB=0x01; //display enable for first display
    _delay(196999); //delay
    PORTB=0x00; //turn off the display
    _delay(196999); //delay

    if(i==9) //just chk whethr i=9?
    {
    RC1=1; //led enable

    }
    else //buzzer enable
    {
    RB5=1;
    }
    }

  2. #2
    kchriste
    kchriste is offline
    You will get more help if you post which development kit you are using. A link would be even better than just the name.
    Last edited by kchriste; 1st March 2010 at 03:59 AM.
    Inside every little problem, is a big problem trying to get out.

  3. #3
    jimmyvarghese143
    jimmyvarghese143 is offline
    &#97;&#114;&#114;&#97;&#110;&#103;&#101;&#100;&#77;&#105;&#99;&#114;&#111;&#109;&#97;&#115;&#116.pdf
    Quote Originally Posted by kchriste View Post
    You will get more help if you post which development kit you are using. A link would be even better than just the name.

    am attaching development kit manual

  4. #4
    kchriste
    kchriste is offline
    Your LED display is multiplexed.
    That means, you'll need to output the 1000's single digit code from map[] on PORTD and then turn on digit one (RB0=1). Then delay apx 2ms. Then turn off digit one (RB0=0)
    Then you'll need to output the 100's single digit code from map[] on PORTD and then turn on digit two (RB1=1). Then delay apx 2ms. Then turn off digit two (RB1=0)
    Then you'll need to output the 10's single digit code from map[] on PORTD and then turn on digit three (RB2=1). Then delay apx 2ms. Then turn off digit three (RB2=0)
    Then you'll need to output the 1's single digit code from map[] on PORTD and then turn on digit four (RB3=1). Then delay apx 2ms. Then turn off digit four (RB3=0)
    Then you repeat the above for as long as you want to display the number. This is best done in an interrupt routine, but it is not mandatory.
    The above will display a static number on the display.
    Last edited by kchriste; 1st March 2010 at 04:42 AM.
    Inside every little problem, is a big problem trying to get out.

  5. #5
    jimmyvarghese143
    jimmyvarghese143 is offline
    Quote Originally Posted by kchriste View Post
    Your LED display is multiplexed.
    That means, you'll need to output the 1000's single digit code from map[] on PORTD and then turn on digit one (RB0=1). Then delay apx 2ms. Then turn off digit one (RB0=0)
    Then you'll need to output the 100's single digit code from map[] on PORTD and then turn on digit two (RB1=1). Then delay apx 2ms. Then turn off digit two (RB1=0)
    Then you'll need to output the 10's single digit code from map[] on PORTD and then turn on digit three (RB2=1). Then delay apx 2ms. Then turn off digit three (RB2=0)
    Then you'll need to output the 1's single digit code from map[] on PORTD and then turn on digit four (RB3=1). Then delay apx 2ms. Then turn off digit four (RB3=0)
    Then you repeat the above for as long as you want to display the number. This is best done in an interrupt routine, but it is not mandatory.
    The above will display a static number on the display.









    #include<pic.h>
    #include<stdio.h>


    void main()

    {
    int i;
    int c;
    char map[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6 F};

    TRISD=0x00; // for diplay/led output
    TRISC=0x00; // latch control
    TRISB=0X00; // display control
    RC1=0;
    RC0=0;
    i=0;
    c=0;
    while(1)
    {

    PORTD=map[i]; //masking the values
    RB3=1; //display enable for first display
    _delay(7000); //delay
    RB3=0;

    PORTD=map[i]; //masking the values
    RB2=1; //display enable for first display
    _delay(7000); //delay
    RB2=0; //turn off the display
    PORTD=map[i];
    //masking the values
    RB1=1; //display enable for first display
    _delay(7000); //delay
    RB1=0;

    PORTD=map[i]; //masking the values
    RB0=1; //display enable for first display
    _delay(7000); //delay
    RB0=0;
    }
    }

    now am getting proper multiplexed didplay.then how i can link this one with rest of program?

Reply to Thread

Similar Threads

  1. C++ programming
    By tuck in Members Lounge
    Replies: 12
    Latest: 9th November 2008, 03:39 AM
  2. Programming
    By gramo in Members Lounge
    Replies: 23
    Latest: 30th April 2007, 11:13 AM
  3. programming
    By srimannarayanakarthik in Electronic Projects Design/Ideas/Reviews
    Replies: 2
    Latest: 29th September 2006, 12:47 PM
  4. Help in programming..
    By carlandrewg in Electronic Projects Design/Ideas/Reviews
    Replies: 2
    Latest: 17th June 2006, 02:03 PM
  5. PROGRAMMING HELP?
    By JATEU_01 in Microcontrollers
    Replies: 1
    Latest: 4th August 2005, 12:45 PM