ya,but tyhe motor speed seem to alter with my code
if i use the following code:
While PORTC.6 <> 0
dir2 = 1 'CCW go down
High PORTC.2 'pulse port for m2
WaitUs 800
Low PORTC.2
WaitUs 800 '50
count2 = count2 + 1
Wend
the motor turning with faster speed.
when i used the while loop the motor turn faster if compare to for loop.
another thing i need to clearify is this :OPTEK Reflective object sensor as i attaced here
i am driving it like a LED Vforward =1.7V using 12V i need to have 510R resistor as to limit the current.but i cannot get any voltage drop across the resistor.it should be around 10.3V theoritically. am i driving the wrong way? Thanks.
yes,this is the way to connect the opto,but how about the transistor part?
currently i am connecting pin 4 to +5V and pin 3 to grd via a 100k resistor.
so if we siad the 100k as load resistor ,then how to size this resistor for me to pump in this input to my uC ?
am driving it like a LED Vforward =1.7V using 12V i need to have 510R resistor as to limit the current.but i cannot get any voltage drop across the resistor.it should be around 10.3V theoritically. am i driving the wrong way?
yes,this is the way to connect the opto,but how about the transistor part?
currently i am connecting pin 4 to +5V and pin 3 to grd via a 100k resistor.
so if we siad the 100k as load resistor ,then how to size this resistor for me to pump in this input to my uC ?
Pin 3 of the opto goes to 0V, pin 4 is the collector of the opto transistor.
Use a 10K resistor from pin 4 to +5V.
Connect pin 4 to the input pin of the PIC.
If the 10K dosnt give enough voltage swing on pin4, when the opto slot is blanked/open, then try a 22K.
hi,
As you say, try higher resistance values.
If you cannot get enough swing, you will have to add an amplifier between the opto pin4 and the PIC. A single transistor amp should be OK.