Circuit:
Program:
#include<P18F452.h>
#define mybit PORTBbits.RB0
void MSDelay (unsigned int);
void main()
{
TRISBbits.TRISB0=0;
while(1){
mybit=1;
MSDelay(250);
mybit=0;
MSDelay(250);
}
}
void MSDelay (unsigned int itime)
{
unsigned int i;
unsigned char j;
for(i=0;i<itime;i++)
for(j=0;j<165;j++);
}
Program:
#include<P18F452.h>
#define mybit PORTBbits.RB0
void MSDelay (unsigned int);
void main()
{
TRISBbits.TRISB0=0;
while(1){
mybit=1;
MSDelay(250);
mybit=0;
MSDelay(250);
}
}
void MSDelay (unsigned int itime)
{
unsigned int i;
unsigned char j;
for(i=0;i<itime;i++)
for(j=0;j<165;j++);
}
Comments
Post a Comment