PWM with pic16f716...need help!!!

Status
Not open for further replies.

Porte

Newbie level 4
Joined
May 1, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,313
Hi, i'm doing a project using pic16f716. And i want to do PWM with this pic. But i don't know how to start my coding. Anyone can give a simple example??? Thanks.

---------- Post added at 14:55 ---------- Previous post was at 14:49 ----------

i need an example in mplab which is Hi Tech form.:-D
 

Hi,

Code:
void main ( void ) {

    /* Configure timer0 and INT interrupts. */
    OPTION = 0xCF; /* Source = Fosc/4, 256:1 pre-scaler, RB0 rising edge interrupt. */
    T0IF = 0;      /* Clear any pending timer interrupt. */
    T0IE = 1;      /* Enable timer 0 interrupts. */

    INTF = 0;      /* Clear any pending external interrupt. */    
    INTE = 1;      /* Enable external (RB0) interrupt. */

    ei();          /* Global interrupt enable. */

    /* Wait for interrupt. */
    for{;;} {
        CLRWDT(); /* Clear watchdog timer. */
    }
}


void interrupt my_int_handler( void ) {

    if( T0IE && T0IF ) {
        /* Handle timer 0 overflow */
        T0IF = 0;
    }

    if( INTE && INTF ) {
        /* Handle INT interrupt */
        INTF = 0;
    }
}
 
Reactions: Porte

    Porte

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…