How to start programming in pic


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Nov 2016
    Posts
    19

    Default How to start programming in pic

    Hello,
    I want to start codding in C the pwm i have programmer how to write code for this like led blinking and all...

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: How to start programming in pic

    Get yourself a C compiler, read the manual then find a forum where C is being discussed.

  3. #3
    Join Date
    Nov 2016
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: How to start programming in pic

    is it fine for pwm??

    #include <htc.h>
    __CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
    #define _XTAL_FREQ 20000000


    void main()
    {
    TRISB=0X00;
    TRISA = 0xff ;
    ADCON1=0b00000000;
    ADCON0=0b10000001;//000 = channel 0, (RA0/AN0)
    ADIF=0;
    ADIE=1;
    PEIE=1;
    TRISC = 0 ;
    PR2 = 0b11111001 ;
    T2CON = 0b00000100 ;
    CCP1CON = 0b00111100;
    PORTC = 0 ;
    while(1)
    {
    __delay_ms(10);
    GO_DONE=1;
    __delay_ms(10);
    while(GO_DONE);
    CCPR1L = ADRESH ;
    }
    }

  4. #4
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: How to start programming in pic

    No, I’s silly. It will sit in while GO_DONE forever, where there is no need to keep setting a register.
    Microchip have their own forum with a beginner section which would be fine for this.
    This is C. If you post it there I’ll fix it.

Similar Threads

  1. PIC 18f252 will not start
    By Armadus in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th July 2011, 12:21
  2. PIC doesn't start witout scope
    By Tobias in forum General
    Replies: 11
    Last Post: - 26th April 2010, 22:49
  3. The PIC does not start its program.
    By Ted's in forum Off Topic
    Replies: 36
    Last Post: - 28th July 2008, 10:22
  4. How can i take start programming
    By mubashir in forum General
    Replies: 5
    Last Post: - 16th May 2007, 02:05
  5. Pic Start Plus Help
    By shawn in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th March 2007, 04:47

Members who have read this thread : 2

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