Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/03/02 14:10
Read: times


 
#25233 - how to make a DC motor run?
hi i'm a very beginner of microcontrollor, i'm using Cygnal 8051 and c51 complier.

here is the code i wrote, all i want to do is to get a dc motor run, just for experimant.

#include<intrins.h>
#include<c8051f000.h>
#include <stdio.h>

sbit motor_go=P0^0; // output port is P0^0

void main (void)
{

WDTCN=0xde; //disable watch dog
WDTCN=0xad;

OSCICN=0x04; //use internal clock
OSCXCN=0x00; //disable all external clock

XBR0=0x08; // enable CEX0 routed to port
XBR2=0x40; //enable crssbar

PRT0CF=0x01; //configure P0.0 as push-pull
for(;;) { //run forever
motor_go=1; //should motor go now??
}
}
i had checked P0.0 and it was 0v. so i havn't do anything to that pin, and what is push-pull and open-drain means.

please help thanks



List of 6 messages in thread
TopicAuthorDate
how to make a DC motor run?            01/01/70 00:00      
RE: how to make a DC motor run?            01/01/70 00:00      
RE: how to make a DC motor run?            01/01/70 00:00      
RE: how to make a DC motor run?            01/01/70 00:00      
RE: Blue links            01/01/70 00:00      
RE: how to make a DC motor run?            01/01/70 00:00      

Back to Subject List