Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC18F2450 for L297/L298 stepper motor control

Status
Not open for further replies.

darkminos

Newbie level 4
Joined
May 22, 2009
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,337
l297 l298

Hi,

I'm still green if it's about electronics and I have the following question: how to control a L297 stepper motor control IC via a PIC18F2450 chip. I've attached an image of part of my circuit to this post. The plan is to sent commands from my PC via USB to the PIC18F2450 which will tell the L297 how to drive the motor. Basicaly i need to know how to connect the PIC18F2450 to the L297. Please be gentle. :D

PS. Do I understand correctly the bit where I connect HOME to a push switch so when it's pressed the IC knows its home position?

Many Thanks
 

pic18f2450

Hi,

Welcome to the forum..

I have not used the L297 chip , but have driven stepper, servo and dc motors from the Pic 18F just using the L298.

The main advantage of the L297 is that it can make micro stepping easier.

Microchip have some very good Application notes for beginners with code examples.
Also have a look at their Mechatronics user guide - plenty of good info.

Have also sent you a PM that might help !
 

l298 stepper

I see your point... I don't really need microstepping as 1.8 deg. should be good enough for my application :) but still I will have to make sure the motor has a ref. point from which it will count the steps (push switch seems like the easiest option)... oh well, any suggestions regarding this circuit are still welcome, and any help will be appreciated!
 

l297 stepper

Hi,

Just had chance to look at the L297 - the Home function is actually an Output from the chip to say it is at its reset position, not the position of the motor.

So using the circuit you have will actually short it out when the button is pressed.

Think if you are wanting a motor home position then its a case of adding a suitable physical sensor like an opto interupter or hall sensor etc.
Some motors do have sensors built in.

Think these two links will give you a bit more practical info.

http://mech.vub.ac.be/teaching/info/mechatronica/finished_projects_2005/PICROCK/Electronic.htm

**broken link removed**


Just on the point of USB, that is a major project for anyone and requires C but you may find some ready to use code on Robotics or CNC forums.
If you are using assembler or want something a bit simpler, use the Usart Rs232 function of the Pic connected to the PCs USB connector via one of the cheap RS232 to USB cable converters.
 

    darkminos

    Points: 2
    Helpful Answer Positive Rating
l298 application note

Hi,

If it's about the USB, can I not connect it directly to the PIC18?

Thanks
 

l297 stepper motor controller

Get the impression you are thinking that the Pic is like a PC where you can Plug and Play.

The Pics are different, they have hardware features like USB on the 18Fs, but you need to provide the controlling software.

USB is one of the more complex Pic functions, for which C programming is a prerequisite. - Microchip even produce a demo kit for this very purpose
**broken link removed**

Also see this current and other posts on PIC / USB



Don't know your reasons for doing this project - if its just for learning Pics and motor control then continuing with that but just doing pic to l297/8 control for now while you learn and add PC connectivety later via rs232, as mentioned ealier.

If you are more into modelling and want pc control etc then think the Robotics forums will help you out better with slighly different programming solutions.
 

l298 stepper motor

Thanks for the posts, today I was talking to Test Development @ work when I noticed a tiny PCB with a PIC18F6(..something) which as it turned out is directly connected to the USB connector (D+/D-) and has the possibility to update firmware with no need for any additional IC's like RS232. :) I will get the circuit diagrams tomorrow and see what makes it tick ;) Also I did manage to get my claws on a development board for stepper motors which has a PIC16 on it and communicates with my PC with no problems (and no additional IC’s, except motor controllers). So what’s the big deal about USB connectivity?, everyone keeps telling me to do something simple for a starter but it seems it’s not a great deal to get it going ...


Sorry just read you post again :D (the part where you say it's mainly a firmware issue) which is not so bad as you can get samples from the net to get it going..
 

microstepping with l297

Hi,

If you have found a little development board that does motor control from the PC then great - sounds just the thing for you to really start learning with.

You don't say if you are programming in C, Basic or Assembler etc ?

As for USB, well perhaps I have not been able to explain it clearly, partly because I have not been able to try it becuase of my lack of knowledge of the program language C18.

To take one of the several Pic18F chips that have the USB hardware, you need a mass of complex C18 programming to establish a link with the PC, and only then can you start to program your code to send and receive data into your main program.

Don't think anyone would care to disagree that doing your own USB is for an experienced C programmer only...... anyone... ??

I don't want to discourage you from learning all about PIcs in any way, its a great interest and learing curve but think USB is a step too far for now.

Attached is a picture of a little board I made to teach myself about motors - its just driven from my 18F pic dev board controlled by switches and an lcd.
Bought the motors in a sale from a local model shop for just a few pounds/ dollars and they are driven by the L298 from the 18F
 

l298 microstepping

Since about 2 years I’m into C Sharp programming so I guess the best option would be to learn how to program in C or C++... I trying to find a compiler for C sharp what would actually make programming the PIC fun! :D but I'm not sure there is one... I'm still in the process of understanding how the whole circuit (about 7 parts, woo-hoo!) interacts witch one another and how it will interact with my PC... Something I have trouble with to understand is what is/isn't important while looking for a microcontroller, when I look at a datasheet that has 450 pages how to quickly determine if that’s the right IC for me? Or am I suppose to study it for 3-4 months and then say.. nah, that’s not what I need :D

Now a naive but very important question: is there a different (easier) way to connect the board to the PC, without hardcore C programming (I guess that’s where the RS232 comes into play)?

By the way - nice board you got there!

Thanks & sorry for being a pain in the ass...
 

pic l297

RS232 is the other standard way to connect to a pc - it can be easily done with C or Assembler.

As for C and USB - on the Pic 18F chips its Microchip who supply much of the usb code in C18 - so you really have to follow their lead.
Microchips IDE and C18 complier are both free downloads.

I do not really know anything much about any version of C, so how similar C Sharp is I couldn't say.
Perhaps a new post on this point will bring some fresh help.

A lot of folk, including those who started with C, agree that starting with Pic Assember is a good way to do things as it gives you a better understanding of the chip structutre.

Agree that everything comes with big manual and datasheets, which should really be used a reference manuals.
Much better to look for the many tutorials that are around, starting with the infamous flashing led.

A good and well supported one is http://www.winpicprog.co.uk/pic_tutorial.htm
 

l297 pic 18f

This might be slightly off-topic, but still within the general area of the original question.

Here's a homework which I give to my students: http://www.prolifictec.com/pcbclass/homework_files_20081102.zip Inside there's a schematic (ExpressPCB format and PDF) that shows how to connect L297 to a motor (either 1 stepper or 2 brushed DC motors).
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top