jorginho1877
New Member
Hello everyone
I am doing the programming of some step by step motors, but I have a doubt in which I want to control the delay with a potentiometer, but I have not been able to do it since the resolution values are not well defined to work with the potentiometer
this is the code
#include <16f877A.h>
#fuses XT, NOWDT
#use delay (clock = 4000000)
#use fast_io(B)
#use standard_io(C)
#use standard_io(D)
#use standard_io(A)
void main()
{
int POT= (input (PIN_A1), 0, 1023, 0, 500); ;
set_tris_B(0b00000000);
while (1){
if (input (PIN_A0)== 1){
output_B(0b00000001);
delay_ms(POT);
output_B(0b00000010);
delay_ms(POT);
output_B(0b00000100);
delay_ms(POT);
output_B(0b00001000);
delay_ms(POT);
}
}
}
I am doing the programming of some step by step motors, but I have a doubt in which I want to control the delay with a potentiometer, but I have not been able to do it since the resolution values are not well defined to work with the potentiometer
this is the code
#include <16f877A.h>
#fuses XT, NOWDT
#use delay (clock = 4000000)
#use fast_io(B)
#use standard_io(C)
#use standard_io(D)
#use standard_io(A)
void main()
{
int POT= (input (PIN_A1), 0, 1023, 0, 500); ;
set_tris_B(0b00000000);
while (1){
if (input (PIN_A0)== 1){
output_B(0b00000001);
delay_ms(POT);
output_B(0b00000010);
delay_ms(POT);
output_B(0b00000100);
delay_ms(POT);
output_B(0b00001000);
delay_ms(POT);
}
}
}