newbie question


Closed Thread
Results 1 to 9 of 9

Thread: newbie question

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    Thanks for ur explanation.This is the program that i write to display the temperature value in seven segment display once LM 35 sense the temperature.As a results from the source code,the seven segment only display the value 16 in seven segment display.Can i know what wrong with this source code?

    #include<16f877.h>
    #device adc=10
    #use delay(clock=10000000)
    #fuses hs, noprotect, nowdt, nolvp

    #byte porta=5
    #byte portb=6
    #byte portd=8

    int i;
    int temp;

    void main()
    {
    set_tris_d(0b00000000);
    set_tris_b(0b00000000);
    setup_port_a(RA0_analog);
    setup_adc(adc_clock_internal);

    do
    {
    set_adc_channel(0);
    delay_ms(10);
    temp=read_adc()/2;

    if (temp=16)
    { portb=0b00000110;
    portd=0b01111101; }

    else if (temp=17)
    { portb=0b00000110;
    portd=0b00000111; }

    else if (temp=18)
    { portb=0b00000110;
    portd=0b01111111; }

    else if (temp=19)
    { portb=0b00000110;
    portd=0b01101111; }

    else if (temp=20)
    { portb=0b01011011;
    portd=0b00111111; }

    else if (temp=21)
    { portb=0b01011011;
    portd=0b00000110; }

    else if (temp=22)
    { portb=0b01011011;
    portd=0b01011011; }

    else if (temp=23)
    { portb=0b01011011;
    portd=0b01001111; }

    else if (temp=24)
    { portb=0b01011011;
    portd=0b01100110; }

    else if (temp=25)
    { portb=0b01011011;
    portd=0b01101101; }

    else if (temp=26)
    { portb=0b01011011;
    portd=0b01111101; }

    else if (temp=27)
    { portb=0b01011011;
    portd=0b00000111; }

    else if (temp=28)
    { portb=0b01011011;
    portd=0b01111111; }

    else if (temp=29)
    { portb=0b01011011;
    portd=0b01101111; }

    else if (temp=30)
    { portb=0b01001111;
    portd=0b00111111; }

    delay_ms(2000);

    }while(1);

    }

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    CCS has a forum here http://www.ccsinfo.com/forum/ for their C compilers. I think you'll get answers a lot faster if you post your questions there for CCS C code examples....;o}
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    thcwefh's Avatar
    thcwefh Guest


    Did you find this post helpful? Yes | No

    Default

    Hi! i'm newbie! I'm trying to learn all in this forum! i'm not good at E. Can you tell me how can i begin to learn about code

Similar Threads

  1. Newbie 74hc595 question
    By manjero in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 22nd January 2008, 23:22
  2. newbie with serial com question...
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th December 2006, 06:34
  3. Newbie Question - Info Please
    By ehoskins in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd October 2006, 15:50
  4. Greetings from Newbie and a question
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 24th July 2006, 16:52
  5. Newbie question
    By senojlr in forum General
    Replies: 7
    Last Post: - 11th April 2006, 22:23

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