Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: MICROCONTROLLER 8051 full report
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
MICROCONTROLLER 8051


[attachment=41486]

C Program to interface stepper motor to 8051 microcontroller and to rotate
stepper motor in a clockwise and anti clockwise direction.
#include <Intel/8051.h>
#define p8255_ctl 0x2043
#define portc 0x2042
#define ctlr_word 0x80
// for clockwise phasea is 0d, phaseb is 0e, phasec is 07 and phased is 0b
// for anti clockwise phasea is 0b, phaseb is 07, phasec is 0e and phased is 0d
#define phasea 0x0d
#define phaseb 0x0e
#define phasec 0x07
#define phased 0x0b
xdata unsigned char *ptr_8255_ctl;
xdata unsigned char *ptr_8255_portc;
void delay(void);
void main ()
{
int i;
ptr_8255_ctl = p8255_ctl;
*ptr_8255_ctl = ctlr_word;
while(1)
{
ptr_8255_portc=portc; //porta address is taken in pointer variable
//different speeds are loaded into pointer
*ptr_8255_portc = phasea;
delay();
*ptr_8255_portc = phaseb;
delay();
*ptr_8255_portc = phasec;
delay();
*ptr_8255_portc = phased;
delay();