Ungku Omar Polytechnic
, Ipoh Perak
Thursday
,23 March 2017
AUTOMATIC CURTAIN SYSTEM
Lecturer Name : DR.HJ HASNIM BIN HARUN
Member's Name : NORAZLIN BINTI SAID
01DNS15F1005
MUHAMAD SYAFIQAL AZANI BIN SAMSUDIN 01DNS15F1002
MUHAMMAD NASRUL FAIZ BIN ROSELY 01DNS15F1030
Class : EMSB
Synopsis
This circuit will open and close the
curtain of your home and office just by
pushing a switch. So , with the help of this unique circuit , we do not need to
move from one place to open and close the curtain.
1)List of hardware ,software and
components
Hardware
i)DC motor
ii)Microcontroller board
Software
i)MPLAB version 8.3
ii)Hi-Tech
C compiler version 2.3
iii)Proteus Professional
2)The circuit diagram for this
project
3)The coding
#include<htc.h>
void
delay(unsigned long);
void
forward(void);
void
reverse(void);
void
stop(void);
//--------------
CONFIGURATION --------------------------------------
__CONFIG
(0x3F3A);
//--------------
DEFINE THE I/O PIN ---------------------------------
//--------------
DEFINE VARIABLE DEFINITION -----------------------
#define
S3
RB0
#define
S4 RB1
#define
MOTOR_2 RB6
#define
MOTOR_1 RB5
#define
PWM RC2
//--------------
WRITE YOUR PROGRAM HERE ---------------------------
void
main()
{
TRISB=0b00000011;
PORTB=0b00000000;
TRISC=0b00000000;
PORTC=0b00000000;
while(1)
{
if(S3==0&&S4==1)
//press sw1, move clockwise
{
forward();
}
else
if(S3==1&&S4==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--)
{
unsigned char j;
for (j=0x50;j!=0;j--)
{
unsigned
char k;
for
(k=0xC;k!=0;k--)
{
}
}
}
}
4)The video below showing the
circuit connection and the and the result of the project
5)Conclusion
From the
presentation day that we have done, it will improve our soft skills and also creativity
in building the project. When we work later on, we can use this skill in our
field of IT.
No comments:
Post a Comment