PDA

View Full Version : simple serial interface



mwalach
03-24-2006, 09:24 AM
Anyone know where I can find a sample schematic for a serial interface? I just want to grab some data that I send out the serial port and manipulate it. I basically need a test rig to better understand how to interface with the serial port. I am writting a cnc driver that will work off a serial port (usb or serial). I would like to make or find a cheap way of taking serial position/step data and convert it to step direction pulses to drive a gecko or xylotex board. I have found some ready made boards like the simplestep, but they are around $200-$250. I am trying to see if I can make a cheaper interface. Anyone know of one, or interested in this type of thing?

thanks,

mw

www.bigbearcnc.com

Al_The_Man
03-24-2006, 09:38 AM
Have you looked at going the PIC Micro route? There should be alot of application sheets on the site.
Al.

mwalach
03-24-2006, 11:21 AM
Microcontroller, I never thought of that. They are probobly a good, cheap way to go about this.

Question,

I always thought a microcontroller was programed with the pc, then disconnected and run on its own. What I want to do is have constant communication with it. Is this possible?

Basically I would want to send step information for x,y,z axis to the microcontroller. Then it would read my data and generate a step pulse and a direction pulse for each axis. I would also want to be able to control the speed of the steps so that the motors arrive at their destination at the same time. ie, if I want to go from 0,0 (x,y) to 1,2 (x,y) it would move y twice as fast as x. I would then have data outputs coming from the microcontroller that I would feed to my motor driver board (step x, direction x and the same for y and z). I have never done any work with pics, but does this sound like a reasonable app?

Al_The_Man
03-24-2006, 12:30 PM
Pic micro's have built in RS232 & USB interfaces to communicate to the PC.
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=64
Also, another method could be with an industry Standard machine control network like Canopen that is also supported by PICmicro.
Al.

gar
03-24-2006, 01:39 PM
060324-1300 EST USA

mwalach:

Your question is not very clear in terms of the device that you are going to control. For example does it include a microprocessor or PC or whatever? Probably not from your description so far.

If you want some broad information on a UART go to www.national.com
put in PC16550D in the search box. Next click on download under PDF, and you will get the data sheet.

I have not read the data sheet lately. But years ago, in the early days of UARTs, very good descriptions of the operation were given. More recently the assumption is made that you have considerable a priori knowledge.

Generally serial transmission means that one bit of information ( 0 or 1) is transmitted in one time interval. To be useful this serial data needs to be assembled in some grouping. This occurs at various levels. Typically in an RS232 communication channel data is sent asynchronously in batches of about 10 bits. Some of these bits do not contain information. Typically in a 10 bit asynchronous word the construction is as follows:
1 Start bit --- required
7 Data bits --- the individual values will fluctuate from one word to the next
1 Even parity bit --- this is an option that is suggested --- varies from word to word to make parity even
1 Stop bit --- required

Asynchronous means that automatic resynchronization occurs every transmitted 10 bit word (or whatever the length is).

The the amount of information contained within this one word is up to 128 combinations, 2 to the 7th power. Adequate for all the characters in the basic ASCII alphabet.

Inherently there has to be a precision clocking signal at each end and it has to be agreed upon before transmission of data. Any arbitrary amount of time is allowed after one word is transmitted before another is sent.

To work form RS232 levels to the 16550 you need RS232 interface chips or other devices. The 16550 parallel side is compatible with 5 V logic circuits. The serial input is also 5 V compatible and that is why interfacing is required to the RS232 levels.

.

mwalach
03-24-2006, 02:31 PM
Your question is not very clear in terms of the device that you are going to control. For example does it include a microprocessor or PC or whatever? Probably not from your description so far.


I am writing a software application that will run on both macs and pcs. It takes a dxf file and converts it to gcode. Then, it takes the gcode file and generates step and direction pulses to drive a stepper motor controller (such as a xylotex or gecko). These stepper drivers need a step direction bit (0,1) and a stream of pulses for stepping movement. Most people design controllers to run off the pc parralel port because you can drive the stepper controller directly by toggling the bits of the parallel port. In the past I wrote a cnc control to do just that. However, I want to control my stepper driver through a USB port (or serial) as most apples, and even pc now do not have a parallel port. I am also hoping to have smoother motor control because some external electronics can hold the drive bits in a buffer. Operating systems get in the way of the bit stream when using the parallel port, and make the stepper motors run choppy.

So, basically I want an inexspensive device that can be plugged into a computers USB port on one end, and then connected to a stepper motor driver. Then, people could use my software and this "go-between" board to control any of the great stepper drivers already on the market. No one seems to make a good, cheap serail controller for the hobby cnc enthusist.

Anyone interested in what I am doing can visit my website at www.bigbearcnc.com

I will release an alpha version of my software soon which will contain the dxf to g-code converter (this will be shareware).

once the driver portion is complete I will likely charge a small amount for it, but not much. I want this to be available to the hobbiest.

gar
03-24-2006, 03:48 PM
060324-1538 EST USA

mwalach:

I believe you will need a microprocessor at the end of whatever your serial connection is for the following reason:

In a Windows system you have multiple processes sharing the main processor time. Thus, it is hard to get precise timing control in some random programmed function at high rates. You want a dedicated system to generate these multiple pulses that require precise time correlation with each other.

I would suggest you use Ethernet from your PC to this remote processor. This will provide electrical isolation, high speed, and up to 328 ft of copper wire cable. Or fiber can be used.

Obviously the remote processor will have sufficient buffer memory to never be starved for data from the main PC.

Your timing information would be generated at the local processor.

.

Al_The_Man
03-24-2006, 04:30 PM
I would consider looking into the available open architecture bus systems that are out there, of which there are many.
Canopen, MODbuss and Sercos etc (or at least model it on same)..
For example Sercos (SErial Real time COmunication System), offers practically real time closed loop of Axis controllers with the ability to close the loop back to the controller, due to the intelligent digital drives reporting position status back to the controller.
There are application sheets around for integrating a PIC micro onto some of these standards.
I guess we've overstepped the original premise, the operative word was 'Simple' Interface. :rolleyes:
Al.