Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic16f887 - driving inputs on a dedicated stepper motor driver - sink output

Status
Not open for further replies.

dsc

Member
Hi all,

I'm using a DM856 stepper motor driver (made by Leadshine) to drive a small stepper motor. The driver takes 3 inputs, here's a print screen from the manual:

**broken link removed**

ENA can be left disconnected as per the manual, so the only inputs used are PUL and DIR, although DIR can also be left disconnected and the motor will simply turn in one direction. Currently I have the PUL+ connected directly to the output pin of a PIC16F887 (PORTC pin 0) and PUL- to 0VDC, but I just noticed that the above connection diagram is different to how I'm doing it. I'm guessing that I need to change the wiring and instead of using the pins on the PIC as source, I need them configured as sink. If so, do I simply connect them like this:

**broken link removed**

and drive the output low to sink current (set PUL high) or high to stop sinking current (set PUL low).

Does the above make any sense or am I doing things wrong? I've never used a PIC output as a sink, so haven't got much experience in the area.

Regards,
T.
 
The I/O pins can source or sink 25 mA. I don't understand your concern.
upload_2013-10-13_13-35-39.png

John
 
Thanks for the reply John, I was mostly not sure about the way the pin should be connected to the PUL+ / PUL- in a sink configuration. If the above diagram (the second one which shows RC0) is correct I will carry on and wire it like this for testing.

Regards,
Tom
 
I have RC0 configured as a digital output via TRISC0 = 0 instruction. The only thing I'm not so sure about is controlling this pin ie. setting it high for no sink and low for sink (ie. PUL is ON at that point). I'm pulsing this output to generate a single step movement on the stepper, previously I was setting RC0 to high for 40us and then setting it back to low. With this sink configuration I will have to do the opposite, set it low to generate a pulse and after 40us set it high again. The default state will be then high for this pin, which means on start up I need to set it high and keep it that way. This will be seen on the driver end as a transition from high to low and might cause me some problems. Is there a way around this? ie start up the PIC with the pin in high state straight from boot up?

Regards,
T.
 
I have RC0 configured as a digital output via TRISC0 = 0 instruction. The only thing I'm not so sure about is controlling this pin ie. setting it high for no sink and low for sink (ie. PUL is ON at that point). I'm pulsing this output to generate a single step movement on the stepper, previously I was setting RC0 to high for 40us and then setting it back to low. With this sink configuration I will have to do the opposite, set it low to generate a pulse and after 40us set it high again. The default state will be then high for this pin, which means on start up I need to set it high and keep it that way. This will be seen on the driver end as a transition from high to low and might cause me some problems. Is there a way around this? ie start up the PIC with the pin in high state straight from boot up?

Regards,
T

I had a similar problem on a servo motor glitching on power up.

(1) 4k7 from port pin to +5v.

(2) Set port bit to '1'.

(3) TRIS port bit to '0'

Fixed mine, but I was not using an opto-isolator [ TC4468 ?? driver ]

D.
 
Thanks D., I've left it as per the manual, so 5VDC into the PUL+ and RC0 connected to the PUL-. I think it works, but I can't figure out how to test it with an oscilloscope, I've connected a probe to the PUL+ terminal, with the ground lead connected to PUL- (effectively RC0), but it seems to pull the pin down to ground and nothing works at that point (ie. the output doesn't switch, no pulse is generated). Is there a special way to measure signals sink'ed through the PIC?

Regards,
T.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top