Solar000
Member level 2
- Joined
- Feb 6, 2013
- Messages
- 49
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Location
- Greece
- Activity points
- 1,649
Hello, i am interfacing pic 16f877a with solenoids using micro c.
I know how to control stepper motors and i thought the code would be similar
but i need some help to determine if its a hardware problem or not.
here is a simpler version of my code but its not working.They are not moving.
I have the solenoids connected to port D.
I think i only have to set to 1 the port to activate the solenoid.
Can you tell me if the code is correct ?
Thank you.
I know how to control stepper motors and i thought the code would be similar
but i need some help to determine if its a hardware problem or not.
here is a simpler version of my code but its not working.They are not moving.
I have the solenoids connected to port D.
Code:
void Movement(){
TRISD = 0x00;
PORTD = 0x00;
TRISC = 0x00;
PORTC = 0x00;
//Delay_ms(20);
PORTD=0xFF;;
PORTC=0b11111111;
Delay_ms(1000);
PORTD=0b00000000;
PORTC=0b00000000;
Delay_ms(1000);
PORTD=0b11111111;
PORTC=0b11111111;
}
void main(void)
{
Movement();
}
I think i only have to set to 1 the port to activate the solenoid.
Can you tell me if the code is correct ?
Thank you.