# lb1847 stepper controller :how to connect to grbl atmega based board with step ,direction,enable , limit? [closed]

i like to use lb1847 chip with stepper motor "both salvaged from old copier"
i made grbl atmega board , this board gives step ,direction,enable and limit leads
so i tried to find corresponding pins on the lb1847 ,but data sheet only shows enable1 and enable2 pins and phase1 and phase2 pins???
so how can i connect the step and direction and enable pins of atmega to these pins of lb1847?!!
there are other logic pins on lb1847 chip to control current and decay .
if data sheet is required i van upload it.

• is the stepping motor compatible with the LB1847 driver? ...... change the program in your atmega board so that it outputs the signals required by the LB1847 Dec 1 '18 at 20:46
• the program on the atmega is grbl ...which gives enable step and direction...so do i need to make another atmega with step and direction functions which translate them to enable and phase signals to the lb1847?? Dec 2 '18 at 1:48

So how can I connect the step and direction and enable pins of ATMega to these pins of LB1847?!

You can't. The LB1847 doesn't accept those as inputs. You'll need to write your own code to send the correct signals to the LB1847.

From the LB1847 datasheet, page 6 gives the "Sequence Table" for the first 32 (0-31) steps of a revolution. It looks like you'll need 12 digital output pins on your ATMega to interface with the LB1847; four current control pins, an enable, and a phase select, for six pins total for each phase (two phases, A and B, gives 12 total).

There's a drawing on page 11 that gives the first half of a revolution. It's not explicitly mentioned anywhere that I saw (in a brief reading of the datasheet), but I'm assuming that you would run the sequences 0-31, then invert the phase select pins PHA1 and PHA2 and run sequences 0-31 again, for a total of 64 steps (0-63) per revolution.

If you look again at the sequence table on page 6, you can see that Phase A's step 16 is to have the enable pin high (which disables the output), and Phase B's step 0 is also to have the enable pin high. From there on, Phase A and Phase B have the same current settings (Phase A's step 17 is the same as Phase B's step 1, etc.).

You could try to code something slick where you only have one phase defined, like Phase A, and then the other phase is the first phase plus an offset of 16 steps, but then you have to keep the PHA pin settings straight, etc.

Memory is generally so cheap that I'd just hard-code the entire table in an include file for your project. Probably I'd write the whole thing out to 64 steps, too, just being sure to invert the PHA settings.

Finally, you keep an internal count of which step you're currently on and write your own subroutine that accepts as inputs the values you're trying to send - direction, steps, enable.

Depending on what you want "enable" to mean, you can "logical OR" your enable (or !enable) with the enable pin determined by the sequence table to turn the stepper off. Then it's just a matter of incrementing (or decrementing) your current step count by the number of steps and ensuring that you wrap from 0 to 63 and from 63 to 0.

• thank you very much for your great explanation and time Dec 4 '18 at 1:19
• this chip is already present on board with M385034Ga158fp microcontroller ,can i reprogram that microcontroller using the same way i program atmega" i use serial programmer not bootloader"...i tried to read its data sheet tofind out which pins to use to program....it has reset button and txd and rxd but not miso or mosi ...if you could just look at this data sheet and give me guidance??..this is link to data sheet digchip.com/datasheets/… Dec 4 '18 at 1:27
• @AhmedAllam - MOSI and MISO are terms for an SPI interface. The datasheet shows pins P00, P01, P02, and P03 are Sin2, Sout2, Sclk2, and Srdy2 - these would be the serial pins; an input, output, clock, and ready pin which would typically signal data available or something similar. This is not your typical hobby microcontroller. This is not programmed in C++ or any other language a hobbyist is typically familiar with. The datasheet says it's a member of the "740 family" and that has its own instruction set. Dec 4 '18 at 14:05
• I would suggest you abandon that chip and just continue developing with your ATMega. If you want to persist with it that's fine, but I'd strongly recommend you get an evaluation board and try programming a processor that's known to be good, that is well documented, that gives you the drivers and instruction set to learn the language, etc. Once you're capable of interfacing with a "known good" chip, then you can try your hand at reviving a part you remove from some scrap machine, but you might fry the chip with static electricity and not know it while trying to get access to it. Dec 4 '18 at 14:15
• The Wikipedia page says the 740 instruction set is still being used in the 38000/740 series and 7200 series chips produced by Renesas, so you could check out their starter kits and cross reference the available kits with the part numbers for the 38000 series and 7200 series chips. I'm afraid I can't help any more beyond this, but if you have a new question the please ask it! Dec 4 '18 at 14:20