Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help for servo motor coding

Status
Not open for further replies.

nervin

Newbie level 1
Joined
Dec 6, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,289
im doin diz simple code,its for the ldr to detect the high and low input..i want to add a servo motor coding in it but im not sure how..im using pic16f684 & mplab ide v8.33 to compile.

i want the motor to keep moving when its low and when high the motor stop..

this is the simple code i did :(how to add servo motor code,if any1 can help me on this tq)

#include<pic.h>
__CONFIG(0x20d4);
#define LDR RA0
#define SWITCH RA1
#define light1 RC2
void init_io(void);
void execute(void);

void main(void)
{
init_io();

while(1)

if(LDR==0)
{
if(SWITCH==1)
{
light1 = 1;

}

else
{
light1= 0;

}
}
else
{
if (SWITCH2==1)
{
light1 = 1;

}

else
{
light1 = 0;

}
}

}
void init_io(void)

{
ANSEL = 0;
CMCON0 = 0;
TRISA = 0b000001;
PORTA = 0b000000;
TRISC = 0b011011;
PORTC = 0b000011;
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top