CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > WoodWorking Machines > DIY-CNC Router Table Machines


DIY-CNC Router Table Machines Discuss the building of home-made CNC Router tables here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 04-18-2010, 03:07 AM
 
Join Date: Mar 2010
Location: none
Posts: 51
spaltiel is on a distinguished road
Control the motors with C and matlab

Hi,

Does anyone know which kind of data I need to send to the parallel port in order to run the motors.

I would like to control my machine via C, Labview or Matlab.

Today i'm using Mach 3 limited version (500 lines).

Amir
Reply With Quote

  #2   Ban this user!
Old 04-18-2010, 04:28 AM
 
Join Date: Aug 2008
Location: UK
Posts: 74
serriadh is on a distinguished road

That's such a vastly wide open question its hard to know where to start. Here are a few counter questions;
  • What are you doing that prevents you from generating geometry information and using off-the-shelf CAM tools to convert it to G-Code? You'd then be able to use an off-the-shelf control program (such as Mach or EMC2) to drive the system for you.
  • What motor control electronics are you using? The communications protocol depends almost entirely on this.
  • Are you a proficient C-coder? Have you done any lowish-level IO coding before?

There are a whole range of plugins and tools for labview and matlab to control motors. Have you looked at any of these? Why aren't they any good for your needs?

Assuming you have a good answer for all of those and still want to code your own driver software, it won't be trivial. I trust you've got a reasonable amount of programming experience!
Reply With Quote

  #3   Ban this user!
Old 04-18-2010, 06:07 AM
 
Join Date: Mar 2010
Location: none
Posts: 51
spaltiel is on a distinguished road

Originally Posted by serriadh View Post
That's such a vastly wide open question its hard to know where to start. Here are a few counter questions;
  • What are you doing that prevents you from generating geometry information and using off-the-shelf CAM tools to convert it to G-Code? You'd then be able to use an off-the-shelf control program (such as Mach or EMC2) to drive the system for you.
  • What motor control electronics are you using? The communications protocol depends almost entirely on this.
  • Are you a proficient C-coder? Have you done any lowish-level IO coding before?

There are a whole range of plugins and tools for labview and matlab to control motors. Have you looked at any of these? Why aren't they any good for your needs?

Assuming you have a good answer for all of those and still want to code your own driver software, it won't be trivial. I trust you've got a reasonable amount of programming experience!
Hi,

I have experience with programing and I am using Keling kit (KL4030 driver with C10 breakout board). I do agree that I need to know the protocol.
I didn't say that Labview or Matlab plugins are not enough however I'm willing to learn the subject.

Amir
Reply With Quote

  #4   Ban this user!
Old 04-18-2010, 06:32 AM
 
Join Date: Aug 2008
Location: UK
Posts: 74
serriadh is on a distinguished road

I would seriouesly recommend investigating motor control plugins. I assume that you have some particular purpose in mind for this project, and by using ready made tools you will probably save yourself weeks of time spent coding and debugging; weeks that you might have otherwise spent making your system produce useful output.

The Keling C10 is just a 'dumb' breakout board, providing buffered (but not isolated) access to external hardware via screw terminals. All you'd need to do to drive steppers, for example, would be to send appropriate values to the pins wired to the stepper driver; you don't need to learn any complex protocol, which is fortunate. You'd greatly benefit from having access to an oscilloscope here so you can see if your system is generating stable pulse trains, etc.

Under windows vista and later, direct control of hardware canot easily be done from software. You may need to write a custom driver using the Windows Driver Development Kit, which is generally agreed to be exceedingly unpleasant to use even by Microsoft developers. Under XP you may be able to use a library called inpout32 to controll the parallel port. This may work under vista as well, but it will be awkward. It is unlikely to work well (or perhaps at all) under 64 bit operating systems.

You'd then have to write a plugin for labview or matlab, something I know nothing about, and use that to communicate with your driver software. Due to the requirements of generating a steady pulse train to drive steppers for most purposes, you may find you need to run your control software in a separate thread or process to prevent processing in the host software (matlab or labiew) from delaying the pulse generation loop. You would need to be familiar with asynchronous programming techniques in order to do this, which are also non-trivial (though easier than writing drivers, in my experience).
Reply With Quote

  #5   Ban this user!
Old 04-19-2010, 02:25 AM
 
Join Date: Mar 2010
Location: none
Posts: 51
spaltiel is on a distinguished road

Originally Posted by serriadh View Post
I would seriouesly recommend investigating motor control plugins. I assume that you have some particular purpose in mind for this project, and by using ready made tools you will probably save yourself weeks of time spent coding and debugging; weeks that you might have otherwise spent making your system produce useful output.

The Keling C10 is just a 'dumb' breakout board, providing buffered (but not isolated) access to external hardware via screw terminals. All you'd need to do to drive steppers, for example, would be to send appropriate values to the pins wired to the stepper driver; you don't need to learn any complex protocol, which is fortunate. You'd greatly benefit from having access to an oscilloscope here so you can see if your system is generating stable pulse trains, etc.

Under windows vista and later, direct control of hardware canot easily be done from software. You may need to write a custom driver using the Windows Driver Development Kit, which is generally agreed to be exceedingly unpleasant to use even by Microsoft developers. Under XP you may be able to use a library called inpout32 to controll the parallel port. This may work under vista as well, but it will be awkward. It is unlikely to work well (or perhaps at all) under 64 bit operating systems.

You'd then have to write a plugin for labview or matlab, something I know nothing about, and use that to communicate with your driver software. Due to the requirements of generating a steady pulse train to drive steppers for most purposes, you may find you need to run your control software in a separate thread or process to prevent processing in the host software (matlab or labiew) from delaying the pulse generation loop. You would need to be familiar with asynchronous programming techniques in order to do this, which are also non-trivial (though easier than writing drivers, in my experience).
Thanks.

I generally agree with you. I'm also trying to arrange oscilloscope to study the signals I generate.

Amir
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 04-17-2011, 10:34 AM
 
Join Date: Apr 2011
Location: pakistan
Posts: 1
naveed e sahar is on a distinguished road

Hi,
today i've the same problem that "spaltiel" suffered a year ago. im using matlab. software is completed... my programme can read autocad file and stores the information of all three axis in three arrays(x y & z). ive made whole graphical user interface as well as my driver's programe is complete at proteus. i can run the motors by atmega16 programmed in c language(vmlab). now how m i gonna do it via parallel port using matlab... ill be very kind if anyone helps me out.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AC Drives control multiple motors Mcyoda General Electronics Discussion 3 06-06-2009 09:13 PM
Newbie- STEPPER MOTORS AND CONTROL WWWOODMAN CNC Wood Router Project Log 12 02-23-2009 08:07 AM
Need Help!- CLIFTON PRECISION + MATLAB/SIMULINK +ADVANTECH + GECKODRIVE raiden86 Servo Motors and Drives 1 09-09-2008 05:18 AM
How to control 5 motors? x+y+z+z1+a? Faber.sum General Electronics Discussion 1 05-05-2006 09:45 AM
Control four stepper motors in unison? Wes LeMarr Stepper Motors and Drives 1 02-28-2006 09:11 PM




All times are GMT -5. The time now is 12:44 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361