Hello Guest it is April 27, 2024, 02:56:53 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - joeaverage

Pages: « 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 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 »
7201
Hi,
sounds like the keys and/or your axes need re ordering. Try using MDI instead.

Go to the MDI(Alt 2) tab. Click on the MDI line and enter some move instructions.

Try G1 X5 F20    --I am assuming your machine is in inches here, if in mm use this instead
      G1 X100 F300  and hit enter.
The X dro should now move to the required co-ord, 5 if in inch, or 100 if in mm.

G1 X0 should now see the DRO decrease back to 0.
Does the X axis move when you do this? If it does now move on to the other axes in turn.

G1 Y5 F20.....enter..... G1 Y0.... enter
G1 Z2...... enter......G1 Z0.... enter

Next while still on the MDI page hit the tab key....and the MPG flyout should appear.
Experiment with the jog buttons. It should confirm which axis moves with each button.
Report back to let us know how you got on.

Craig

7202
Mach4 General Discussion / Re: Mach 4 Machtric 2.2kw VFD Modbus
« on: January 24, 2017, 06:11:32 PM »
Hi Zuxztah,
I adopted the approach I did so that I could explain how it works and give you the chance to learn it too.

Glad that you are familiar with the Edit Screen function, you are going to use it a lot while you get this setup.

You are also correct that as I've written it spindle speed is an issue. I did it this way for simplicity... at the beginning...
it will change!

What will evolve is two small button scripts for the two buttons, three m functions; m03, m04 and m05 that take over from
the standard Mach4 functions by the same name and another small piece of code in the PLC script to maintain spindle speed
in step with your Gcode and/or MDI.

Let me know when you've digested and maybe got that previous lot of code working and will make a start on the rest. Good news
is if you understand what I've done then the rest will be easy.

Craig

7203
Mach4 General Discussion / Re: Mach 4 Machtric 2.2kw VFD Modbus
« on: January 24, 2017, 05:21:01 PM »
Hi Zuxztah,
I have the same problem with less organic excuse.

The good news tho is that you only need four separate chunks of code each no more that half a dozen lines long. I don't claim to be
good enuf to write them and have them work straight off aside from which you would learn nothing in the process.

With the Program Run Tab on screen with Mach4 disabled, click Edit Screen on the Operator menu.
Click the Spindle CW/Stop button on the right hand side of the page. This should highlight the 'button code' in the screen elements tree on
the upper left and will show either the 'properties' or 'events' of the button at the lower left. With the 'properties' displayed you can change colours,
sizes, texts, enabled states and all that sort of stuff.

What I want you to have a look at tho is the 'events' associated with the button. You will note, assuming the default screen, that the left-up script
is the function 'SpinCW()'. The 'left-up' means the up-click event of the lefthand mouse button whereas the 'left-down' refers to the down-click event.
If you click on that and click on the rightmost extension button an editor window will open with the script for the button.
In this case it's pretty boring, it just the function SpinCW(), but notice the code underneath, all commented out but is in fact a copy of the code which
runs when SpinCW() is called. You may note that all it does is either set the spindle direction signal to off or set it to 1, ie CW. This won't work for you
because your using Modbus to control you spindle. You will have to substitute SpinCW() with code that turns your spindle CW at a given speed.

Just as a matter of interest the LUA editor display window is just a fraction of the LUA SCRIPT. All of the buttons, LEDs, DROs and so on all have their
own little bits of code associated with them. They are all gathered up into one script, the LUA SCRIPT, and it is that conglomerate which runs. You can view
the LUA script on the Oeratrator menu 'Lua Script'. Its quite a sizeable file, about 1000 lines on my machine. In there you will find the Screen load script, Screen
Unload script, Signal script and others besides. Over a period of time as you customise your machine, like your Modbus control, your code will end up
in this file as well. You can view it but you can't run or edit it. If you wish to make alterations you will have to open each button or what have you and edit
its script/code there. Note also that if you have say a button script open in the LUA editor then the conglomerate file can't be bought together because a
piece of it is still open in the editor. If you wish to run the code you need to save any edits and commonly close the editor window before the complete LUA
script can be compiled and run. Don't worry you will forget from time to time and Mach4 will hang as a result. You will have to close Mach4, sometimes
with the help of the 'Task Manager,' and reopen.

Open 'Lua Script' per the above and have a look at lines 136-165. These are the 'event scripts' for the two spindle buttons on screen.

With the left-up script in the Lua Editor rather than delete SpinCW() just comment it out, ie put '--' in front of it. Means that if you wish to unwind what you've
done at a later date its easy to do.

Type in this code (before or after the comments doesn't matter):
local inst = mc.mcGetInstance();
local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON);
local sigState = mc.mcSignalGetState(sigh);
if (sigState == 1) then
      local hregcontrol=mc.mcRegGetHandle(inst,"modbus0/spinCntrl")
      mc.mcRegSetValue(hregcontrol,01)      -- substitute 01 with whatever bit pattern is required to turn the spindle clockwise
      local hregfrequency=mc.mcRegGetHandle(inst,"modbus0/freq")
      mc.mcRegSetValue(hregfrequency,2000)   -- the value 2000 ie 200Hz will as this script grows and gets more sophisticated will be variable but for now....
else
      local hregcontrol=mc.mcRegGetHandle(inst,"modbus0/spinCntrl")
      mc.mcRegSetValue(hregcontrol,,00)   - substitute 00 with whatever bit pattern is required to stop the spindle
end

Please note that I haven't tested this code, without a working 485 link I can't. Note also that some changes could be made to make it better but
try and read it thru and understand what is trying to do.

If sigState=1 (it must have been 0 before), then we want to turn the spindle on, ie update your two Modbus registers to turn the spindle CW and set
a  frequency. If sigState~=1 (it must have been 1 before), then we want to turn the spindle off.

Craig

7204
Mach4 General Discussion / Re: Mach 4 Machtric 2.2kw VFD Modbus
« on: January 24, 2017, 02:28:24 PM »
Hi Zuxztah,
not sure but don't think so. You may have noted in one of the examples included in the communication pdf you posted
it wrote to and address 2102 hex. Can you find anywhere in the lists such an address? I can't and yet it used as an example,
ie it must exist. My guess it that if you wish to write to the parameters, ie set some feature of the VFD, then you use the
command address as listed. If you wish to read data from the VFD addresses will be in the range 2100 hex to who knows.

This is from my Delta VFD manual:
Code: [Select]
2103H Output frequency (H)
2104H Output current (A*********.X)
2105H DC-BUS Voltage (U*********.X)
2106H Output voltage (E*********.X)
2107H Step number of Multi-Step Speed Operation
2108H Step number of PLC operation
2109H Content of external TRIGGER
210AH Power factor angle
Status
monitor
Read only 210BH Estimated torque ratio (*********.X)
210CH Motor speed (rpm)
210DH PG pulse (low word) /unit time (Pr.10-15)
210EH PG pulse (high word) /unit time (Pr.10-15)
210FH Output power (KW)
2110H Reserved
2200H Feedback Signal (*********.XX %)
Chapter 5 Parameters

Note the address block of 2100 hex to 2200 hex. I very much suspect your VFD is the same.

Still recommend you don't get hung up on it. You stated earlier that you had this VFD working over Modbus with Mach3 but without speed
feedback. With current knowledge you don't have speed feedback in Mach4 either, big deal.

You still have to write the LUA scripts necessary to give you programmatic control of your spindle.

To date you have really only used the Modbus and Refile plugins to set up your 485 comm link. You have yet to write any code and I suspect
you will find it rather harder and more confusing than what you have done to date. Don't get hung up on a detail.

Craig


7205
Mach4 General Discussion / Re: Mach 4 Machtric 2.2kw VFD Modbus
« on: January 24, 2017, 10:56:10 AM »
Hi,
I agree the manual is not clear, by my reading the address should be 0004hex. What I suspect is that you have to
prepend with another number to get the data address. Try emailing the manufacturer.

May I suggest don't bother with reading the speed at the moment, just concentrate on controlling the spindle.

Craig

7206
General Mach Discussion / Re: bit more help please
« on: January 23, 2017, 08:40:43 PM »
Hi,
the two most likely explanations are:

1) Check the Active Low setting in Ports and Pins Input tab
2) That your BOB has either a pull-up or pull-down resistor such that Mach3 believes the input is active all the time.

How about a screen shot of your Inputs. Also need the manual for your BOB.

Craig

7207
General Mach Discussion / Re: Motherboards And Mach3, questions..
« on: January 23, 2017, 02:16:59 AM »
Hi,
I used an Atom based single board computer and two PPs for several years no problems. The Atom is a tiny and slow
CPU but adequate.

I now use the same board for Mach 4 and a SmoothStepper, again no problems. It can be a bit slow to load a large file but
it runs fine. Both Mach3 and Mach4 are not hugely CPU intensive, they don't require much grunt but they can't afford to
be interrupted by other programs or services.

I have also run Mach4 and ESS with my laptop (i7 @2.5Ghz and 16G RAM) and it made absolutely no difference to how Mach4
runs, it does load big files faster but that's it. Big and/or powerful PCs offer no advantage, save your money for better steppers/spindle/
ballscrews/drivers/tools......

Craig

7208
Mach4 General Discussion / Re: Lua
« on: January 22, 2017, 08:02:15 PM »
Hi Craig,
I'm a newbie at LUA coding. I have programmed before in FORTRAN as a student and in more recent years VB and C,
also like to think I'm pretty fair in assembler. LUA has been a bit of a challenge, while it is deceptively simple its power
and flexibility is right up there.

When coding I have
https://www.lua.org/pil/contents.html permanently on the taskbar.

Much of the code that we are trying to produce involves manipulating Mach4 and consequently the Mach 4 API.chm is also
on the taskbar.

The other resource are the existing LUA scripts within Mach4 and LUA Examples in the Mach4Hobby directory, often you can cut
and paste or otherwise adapt examples to your needs.

Craig

7209
Mach4 General Discussion / Re: Lua success with external buttons to Mach4
« on: January 22, 2017, 06:22:23 PM »
Hi,
Ah!, that makes sense, haven't read that bit. Still it makes the calculation even easier:

ratio=0.5+value

ie with knob full CCW, voltage =0 therefore value=0 therefore ratio=0.5
    with knob full CW, voltage =3.3 therefore value=1 therefore ratio=1.5

and isn't that what we're trying to achieve?

Craig

7210
Mach4 General Discussion / Re: Mach 4 Machtric 2.2kw VFD Modbus
« on: January 22, 2017, 05:44:54 PM »
Hi,
not quite. The Modbus functions run every 25ms or so, this means that the Regfile register is near enuf to a live value of the
actual motor speed. That register will have to be read and displayed on a regular basis so the display becomes 'live'.

The PLC script is the ideal way to achieve this. The PLC script runs about every 40ms. In that script you will insert some code
that reads the register, probably with some sort of calculation and formatting and display it on the screen. Lets say the register
you have created is called modbus0/ActSpeed

Append to PLC script:
hreg=mc.mcGetRegHandle(inst,"modbus0/ActSpeed")
local speed=mc.mcRegGetValueString(hreg)   --  have read it as a string just to be on safe side
local RPM =tonumber(speed)/10*60   --   convert speed to a number, divide by ten to get frequency and multiply by sixty to get rpm
scr.scrSetProp(droTrueSpindle,RPM)   -- not sure about this statement just yet will have to do some more reading/experimenting

Craig

Pages: « 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 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 »