Wednesday, 22 March 2017

SCREEN PROJECTOR

LECTURER NAME:
DR HAJI HASNIM B. HARUN

GROUP MEMBERS:-

NOR AFIQAH BT MOHAMAD RAZIF                                  01DIS15F1016
ARIFFA YUNALIS BT MOHD YAZID                                   01DIS15F1029
NURUL AFIFAH BT AZIZ                                                      01DIS15F1030
WAN HASIMAH BT MOHAMAD                                          01DIS15F1026

CLASS EMSA


PURPOSE


The aim is to allow the projector up and down using the switch when pressed. Thus we do not need  to do it manually and saves time.

A) List of hardware and software

Hardware
-Unistepper Motor
-Resistor 10k
-Resistor 1k
-Switch
-L293D

Software
-MPLAB IDE v8.83
-Proteus 8 Professional

B) Circuit diagram for this project






C) Coding

  #include<htc.h>
       void delay(unsigned repeat);
       void clockwise(void);
       void counterclockwise(void);
       void stop(void);

//--------------- CONFIGURATION ------------------------------------
       __CONFIG (0x3F3A);
//--------------- DEFINE THE I/O PIN -------------------------------
//--------------- DEFINE VARIABLE DEFINITION -----------------------

   #define sw1      RB0
   #define sw2      RB1
   #define PWM      RC2

//--------------- WRITE YOUR PROGRAM HERE --------------------------

void main()
{
       TRISB = 0b00001111;
       PORTB = 0b00000000;

       TRISC = 0b00000000;
       PORTC = 0b00000000;
while(1)
       {

       if (sw1==0&&sw2==1)
       {
       clockwise();
       }
       if (sw1==1&&sw2==0)
       {
       counterclockwise();
       }
       if (sw1==1&&sw2==1)
       {
       stop();
       }
        else
{}
}
}

void clockwise(void)
{
      PWM=1;
      PORTB=0x10;
      delay(1);
      PORTB=0x40;
      delay(1);
      PORTB=0x20;
      delay(1);
      PORTB=0x80;
      delay(1);
}


void counterclockwise(void)
{
     PWM=1;
     PORTB=0x80;
     delay(1);
     PORTB=0x20;
     delay(1);
     PORTB=0x40;
     delay(1);
     PORTB=0x10;
     delay(1);
}
void stop(void)
{
     PORTB=0xF0;
     sw2 = 1;
     PWM=0;
}
void delay(unsigned repeat)
{
unsigned char i;
for (i=0x10;i!=0;i--)
       {
       unsigned char j;
       for (j=0x20;j!=0;j--)
       {
       unsigned char k;
       for (k=0xC;k!=0;k--)
              {
              }
       }
       }
}

D) This picture show that circuit are connection








this picture show when we press the switch, the LED blinks.




E) Conclusion

The aim project is to move the Stepper Motor to clokwise and counter clokwise.



No comments:

Post a Comment