lamterteg
Newbie level 3
- Joined
- Feb 28, 2015
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 25
Hi PIC i am new begginer on pic programming
as i want to start a project named running motor via ldr with pic16f877:
when a source light light on ldr a dc motor runs
when the source shutts off the dc motor shutdown
i've already start programming using microc but i get a problem that motor is not running
code:
the simulation:
as i want to start a project named running motor via ldr with pic16f877:
when a source light light on ldr a dc motor runs
when the source shutts off the dc motor shutdown
i've already start programming using microc but i get a problem that motor is not running
code:
HTML:
void initialise(){
TRISC=0xfe;
TRISA=0x01;
ADCON0=0b10000001;
ADCON1=0;
PORTC=0;
}
void convert(){
while(GO_DONE);}
void light(){
int lightlv =((ADRESH<<8)+ADRESL);
if(lightlv>365)
PORTC=1;
}
void main() {
initialise();
while(1){
convert() ;
light();
delay_ms(4000);}
}
the simulation: