8051 MICROCONTROLLER TUTORIALS FOR A NEWBIE
Monday, 1 October 2012
Interfacing Stepper motor with 8051 microcontroller
Interfacing Stepper motor with driver circuit and 8051 microcontroller.
There are 3 buttons for forward, reverse and stop functions.
Circuit Diagram
C Code
Code:
#include <reg51.h> #include <absacc.h> sbit p10=P1^0; sbit p11=P1^1; sbit p12=P1^2; #define UP 20 #define DOWN 30 #define STOP 40 void delay()//Delay process { unsigned i,j,k; for(i=0;i<0x02;i++) for(j=0;j<0x02;j++) for(k=0;k<0xff;k++); } main() { unsigned char temp; while(1) { if(p10==0) { temp=UP;//Control is transferred P2=0X00; delay(); } if(p11==0) { temp=DOWN;//Inversion of control P2=0X00; delay(); } if(p12==0) { temp=STOP;//Control stop } switch(temp) { case DOWN : P2=0X01;//Inversion of control //0011 delay(); delay(); P2=0X02;//0110 delay(); delay(); P2=0X04;//1100 delay(); delay(); P2=0X08;//1001 delay(); delay(); break; case UP : P2=0X08;//Control is transferred delay(); delay(); P2=0X04; delay(); delay(); P2=0X02; delay(); delay(); P2=0X01; delay(); delay(); break; case STOP ://Control stop P2=0X00; delay(); delay(); break; } } }
Download proteus file: ex-22.zip
Thursday, 27 September 2012
Architecture and features of 8051 microcontroller
gg
8051 architecture and features :- 8051 is also known as a MCS-51 which is developed by Intel in 1980. It has 8-bit CPU, memory, timers, counters, interrupt controller and serial I/O are highly integrated on single chip. It is a 40-pin IC. It has 4 byte input-output port, EEPROM of 4KB and RAM of 128 bytes. Architecture and Pin diagram of 8051 is shown below.
Subscribe to:
Posts (Atom)