EXP NO 7 MA PROGRAMS

#include <P18f4520.h>
#pragma config OSC=HS
#pragma config PWRT=OFF
#pragma config WDT=OFF
#pragma config DEBUG=OFF, LVP=OFF
#define D1 PORTBbits.RB4
#define D2 PORTBbits.RB5
unsigned char data;
void timer0(void);
void main()
{

TRISD=0X00;
PORTD=0x00;
ADCON1=0x0F;
TRISBbits.TRISB4=0;
TRISBbits.TRISB5=0;
D1=1;D2=0;
while(1)
{
D1=~D1;
D2=~D2;
timer0();
}

}
void timer0(void)
{
T0CON=0x01;
TMR0H=0x00;
TMR0L=0X00;
T0CONbits.TMR0ON=1;
while(INTCONbits.TMR0IF==0);
T0CONbits.TMR0ON=0;
INTCONbits.TMR0IF=0;

}
Previous Post Next Post