ASYRAFULLAH BIN ATIKULLAH (01DIP15F1053)
MUHD FIQRI BIN MOHD AZMAN (01DIP15F1069)
AMIRUL AZHAR BIN MOHD HANAPI (01DIP15F1044)
SYNOPSIS
Pengisar telur merupakan satu alat yang akan mengisar telur mengikut kelajuan yang ditetapkan sendiri oleh pengguna. Contohnya, pengguna boleh menetapkan kelajuan sama ada perlahan,sederhana atau laju.
LIST OF HARDWARE AND SOFTWARE
HARDWARE :
- DC Motor
- Project Board
- PIC16F877A
- Motor Driver L293D
- Jumper Wire
- SK40C Board
- Programmer
SOFTWARE :
- MPLAP IDE (32 bit)
- Proteus 8 Professional
CODING
#include<htc.h>
void delay(unsigned long);
void forward(void);
void delay(unsigned long);
void forward(void);
void reverse(void); void stop(void);
CONFIG (0x3F3A);
#define sw1 RB0
#define sw2 RB1
#define MOTOR_2 RB4
#define MOTOR_1 RB5
#define PWM RC2
//-------------- WRITE YOUR PROGRAM
HERE ----------------------------
void main()
{
while(1)
{
TRISB=0b00000011; PORTB=0b00000000;
TRISC=0b00000000; PORTC=0b00000000;
if(sw1==0&&sw2==1) //press
sw1, move clockwise
{
forward();
}
if(sw1==1&&sw2==0) //press
sw2, move counter clockwise
{
reverse();
}
else
{
stop(); //stop
the motor
}
}
}
void
forward(void)
{
MOTOR_1=0; MOTOR_2=1; PWM=1;
}
void
reverse(void)
{
MOTOR_1=1; MOTOR_2=0; PWM=1;
}
void stop(void)
{
MOTOR_1=0; MOTOR_2=0; PWM=0;
}
void
delay(unsigned long)
{
unsigned char
i;
for
(i=0xDE;i!=0;i--)
{
Lecturer Signature : Name:
Date:
Time:
|
for
(j=0x50;j!=0;j--)
{
unsigned char
k;
for
(k=0xC;k!=0;k--)
{
}
}
}
}
VIDEO
No comments:
Post a Comment