Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 5th May 2006, 06:52 PM   (permalink)
Red face Rs-232, Pic Stepper Motor Interface?

HEY,
Id like to use pic to control a stepper motor. The input commands of the PIC should come through the RS-232 serial port. Ive seen the attached schematic online but I can't see where is the RS-232 input to the pic micro-controller... Can u help me plz? and if anyone has any relevant schematic diagram? your help is deeply appreciated
Thanks
Attached Images
File Type: gif serial-stepper.gif (3.4 KB, 94 views)
perpetual_dream is offline  
Old 5th May 2006, 07:49 PM   (permalink)
Default

Hi,

The schematic you posted does not show a PIC microcontroller...

Do you have a particular PIC in mind?

Regards, Mike
Mike, K8LH is offline  
Old 5th May 2006, 08:24 PM   (permalink)
Default

HEY,
THERE IS... THE PIC12C509 .... I'm intending to use the PIC16F628 OR PIC16F84 incase the 16f628 didn't arrive on time. I don't need a complicated functionality. All I need is to control the stepper from the computer using a microcontroller interface so I searched the internet and thought that the implementation of 12C509 would be similar... isn't it?
thanks for the reply...
perpetual_dream is offline  
Old 5th May 2006, 08:45 PM   (permalink)
Default

Please forgive me... I missed that...

It seems pin 4 is being used to receive RS232 data... I've done this on 8 pin 12F675 and 12F683 devices utilizing bit-banged serial code but I used 2N7000 (BS170) N-channel MOSFETs for the interface...

Regards, Mike
Attached Images
File Type: jpg RS232 Circuit for 12F683.jpg (47.9 KB, 79 views)
File Type: jpg RS-232 Circuit for 16F627A.jpg (46.3 KB, 168 views)

Last edited by Mike, K8LH; 6th May 2006 at 03:39 PM.
Mike, K8LH is offline  
Old 5th May 2006, 09:15 PM   (permalink)
Default

I'd hold out for the 628 as that has an async port, bitbang serial I/O is a bit of a pain, especially to debug. You'd only need the RX side of mike's circuits, by the way since your diagram did not show TX in use.
philba is offline  
Old 6th May 2006, 06:46 AM   (permalink)
Default

Does the original design look ok for you guys? It appears to be less compicated.... I can implement it on PIC16F628 or PIC16F84, TRUE?
THANKS AGAIN GUYS.....
perpetual_dream is offline  
Old 6th May 2006, 06:54 AM   (permalink)
Default

I've seen 22K resistors used in PIC rs232 ports for years.

Here's the old parallax app notes including code & schematics.
Attached Files
File Type: pdf picapp.pdf (251.9 KB, 75 views)
__________________
Bill
Home of the
Firefly PIC Tutor
Inchworm ICD2

http://www.blueroomelectronics.com
William At MyBlueRoom is offline  
Old 6th May 2006, 09:21 AM   (permalink)
Default

Quote:
Originally Posted by philba
I'd hold out for the 628 as that has an async port, bitbang serial I/O is a bit of a pain, especially to debug. You'd only need the RX side of mike's circuits, by the way since your diagram did not show TX in use.
Bit banging serial is dead easy on a PIC, and not a pain at all, hardly any more complicated than using the USART.

HOWEVER! - it's still worth using the 16F628 and USART, as it means you don't waste processor cycles bit-banging the serial routines.

I've never got around to completing my stepper PIC tutorial yet (so much to do and so little time!), but essentially I used timer interrupts to do the stepping (with tables for the step patterns), and using a switch on an I/O pin to select half or full step modes. I did implement a bit-banged serial port though, and controlled it through that - although, as I said previously, using the USART in the 628 would be advantageous (my code was based on some old 16C84 code I wrote years ago - before the 628, or even the F84).

You should be aware though that the USART requires inverted data, so you need to use a MAX232, or similar interface, that inverts the data.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 7th May 2006, 06:16 PM   (permalink)
Default

OK.... THANK U ALL GUYS....
Ive found the PIC application notes really helpful so 2sum up I can use the attached diagram with the PIC outputs being connected to the ULN 2803 instead of being connected to the LEDS? YES OR NO?
THANKS AGAIN FOR YOU ALL... U R BY BY FAR THE BEST HELPING FORUM ONLINE
Attached Images
File Type: jpg serial.JPG (31.9 KB, 54 views)
perpetual_dream is offline  
Old 7th May 2006, 06:21 PM   (permalink)
Default

Quote:
Originally Posted by perpetual_dream
OK.... THANK U ALL GUYS....
Ive found the PIC application notes really helpful so 2sum up I can use the attached diagram with the PIC outputs being connected to the ULN 2803 instead of being connected to the LEDS? YES OR NO?
THANKS AGAIN FOR YOU ALL... U R BY BY FAR THE BEST HELPING FORUM ONLINE
Yes you could, however you should be aware that the diagram you posted is a serious antique - in car terms it's not a model-T Ford, more a horse and cart!.

Check my tutorials for far more modern diagrams.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 7th May 2006, 06:24 PM   (permalink)
Default

Yep, you can put a ULN2803 in place of the diodes. You shoud hook up pin 10 of the ULC2803 (the diode clamp) to the positive of your stepper motor power.
Attached Images
File Type: gif hippo3.gif (39.9 KB, 46 views)
__________________
Bill
Home of the
Firefly PIC Tutor
Inchworm ICD2

http://www.blueroomelectronics.com
William At MyBlueRoom is offline  
Old 7th May 2006, 11:16 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
Bit banging serial is dead easy on a PIC, and not a pain at all, hardly any more complicated than using the USART.
maybe for you or me but for someone who hasn't done it before, it can be tricky. especially if it requires debugging. I'd rather recommend a path with as few complications as possible.
philba is offline  
Old 7th May 2006, 11:36 PM   (permalink)
Default

Quote:
Originally Posted by philba
maybe for you or me but for someone who hasn't done it before, it can be tricky. especially if it requires debugging. I'd rather recommend a path with as few complications as possible.
Philba,

T'was a fun learning experience for me but it does require some time and effort...

Not to worry... Should you ever find yourself in a position where a little 8-pin 12F675 or 12F683 would fit the bill and you need reliable bit-banged half-duplex or full-duplex serial I/O, with 16 byte circular Rx and Tx buffers no less, please don't hesitate to ask... You can also do half-duplex I/O using a single pin...

Kind regards, Mike
Attached Images
File Type: jpg RS232 Parasitic Power #2.JPG (73.7 KB, 89 views)
Mike, K8LH is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 05:46 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker