Pic16f877a

Discussion in 'Programmer's Corner' started by wailoon86, Sep 12, 2007.

  1. wailoon86

    Thread Starter New Member

    Sep 12, 2007
    1
    0
    Hi guys.
    I'm new to this website.
    Well, I'm basically trying to light up an LED with PIC16F877A using CCS C compiler.
    Is my code make sense?
    Thanks for your help.
    #include <16F877A.H>
    #use delay(clock=20000000)
    #fuses hs,nowdt,noprotect

    void main()
    {
    set_tris_d(0b00000000);
    for(;;)
    {
    output_high(PIN_B0);
    delay_ms(1000);
    output_low(PIN_B0);
    delay_ms(1000);
    }
    }
     
  2. Art

    Distinguished Member

    Sep 10, 2007
    785
    61
    I'm not used to pic C, but i tlook about right.
    Does it not work?
     
  3. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    Code ( (Unknown Language)):
    1. #include <16F877A.H>
    2. #use delay(clock=20000000)
    3. #fuses hs,nowdt,noprotect
    4.  
    5. void main()
    6. {
    7. set_tris_d(0b00000000);
    8. for(;
    9. {
    10. output_high(PIN_B0);
    11. delay_ms(1000);
    12. output_low(PIN_B0);
    13. delay_ms(1000);
    14. }
    15. }
    Should set_tris_d() be set_tris_b()?

    And you can use the CODE tags to make it more readable ;)
     
Loading...