awanis
Junior Member level 1
how can i change this program to PIC16F877a
im beginner in micro controller..
this program is use to control the speed motor..
#include <p18f4580.h>
#pragma config OSC = HS
#pragma config WDT = OFF
#pragma config LVP = OFF
unsigned char x;
void read()
{
ADCON0bits.GO = 1;
while (ADCON0bits.GO == 1)
x = ADRESH;
}
void main (void)
{
ADCON1 = 0x00;
ADCON2 = 0x05;
TRISD = 0x00;
read();
CCP1CON=0;
PR2=250;
TRISCbits.TRISC2=0;
T2CON=0x01;
CCP1CON=0x3C;
TMR2=0;
T2CONbits.TMR2ON=1;
while(1)
{
ADCON0 = 0b00000101;
read();
CCPR1L = ~x;
PIR1bits.TMR2IF=1;
while(PIR1bits.TMR2IF==0);
PORTD = 0x01;
}
}
im beginner in micro controller..
this program is use to control the speed motor..
#include <p18f4580.h>
#pragma config OSC = HS
#pragma config WDT = OFF
#pragma config LVP = OFF
unsigned char x;
void read()
{
ADCON0bits.GO = 1;
while (ADCON0bits.GO == 1)
x = ADRESH;
}
void main (void)
{
ADCON1 = 0x00;
ADCON2 = 0x05;
TRISD = 0x00;
read();
CCP1CON=0;
PR2=250;
TRISCbits.TRISC2=0;
T2CON=0x01;
CCP1CON=0x3C;
TMR2=0;
T2CONbits.TMR2ON=1;
while(1)
{
ADCON0 = 0b00000101;
read();
CCPR1L = ~x;
PIR1bits.TMR2IF=1;
while(PIR1bits.TMR2IF==0);
PORTD = 0x01;
}
}