Hello Guest it is March 28, 2024, 03:24:51 PM

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 »
5701
Mach4 General Discussion / Re: Confusion about home switch location
« on: December 10, 2017, 02:23:13 AM »
Hi,
it doesn't really matter where the home switches are with 'home offset' you can effectively nominate any location as your home or reference position.

When you hit <Ref All> each axis in turn drives until its home switch activates, then it backs off until the home switch deactivates and THEN......
it can do one of two things:
1) It can set the machine co-ordinate for the axis as zero....or
2) It can set the machine co-ordinate as your home offset per your designation.


Imagine you have home switch on your X axis 50mm from the lefthand end. When referencing if you select option 1) above the machine co-ordinate at that
location would be 0. So your X axis can range from -50 at the extreme left to (max-50) at the extreme right. This would work fine but its likely to be confusing,
a reference location that is not in the centre or at either end is not that logical.

You could choose option 2) and nominate your X home offset as 50mm. Under this circumstance when the machine homes the X axis it drives until the home
switch activates as normal but it resets the machine co-ordinates to 50. If you then jogged the axis further to the left the machine co-ords would reduce
until you were at or near the limit switch at the extreme left of the axis at X machine co-ordinate 0. Note that the axis does not drive anywhere unusual or
anything like that it just resets the machine co-ordinate to some value other than 0. This has the effect of saying that the machine zero is 50mm from the
home switch.

May I suggest experimenting a bit. Put some different values in the X home offset on the homing page and watch what happens. Make sure that your DROs
are displaying machine co-ordinates. With some offset see which way and by how much you would have to jog to bring the X axis machine co-ord to zero.

Craig

5702
Mach3 under Vista / Re: Mach3 Mill installing, but not Turn
« on: December 10, 2017, 01:59:53 AM »
Hi,
you can try that if you like but I don't think it will make any difference.

You are opening Mach and it is selecting the mill profile.

Have you tried running Mach3.exe as I suggested? It should ask you, and you are required to select the profile you want to run. Has that happened?

Craig

5703
Mach3 under Vista / Re: Mach3 Mill installing, but not Turn
« on: December 09, 2017, 06:56:17 PM »
Hi,
if you run Mach3.exe  from the Mach folder you will be asked to select the profile you want to run.

Sounds to me like the shortcut you are using automatically selects the mill profile.

Craig

5704
Hi,

Quote
No wonder it is so hard to find any boards that support MACH4.
Rubbish there are some great Mach4 products on the market, it seems that you don't want to pay for them.

Craig

5705
Mach4 General Discussion / Re: Mach4 Lua don't support bitwise operators
« on: December 08, 2017, 06:55:40 PM »
Hi,
been experimenting some more and while the version of Lua that Mach appears to use is 5.2 the rules covering coercion as in the 5.3 manual
seem to apply and are rather more complete than the sketchiest of explanations in the 5.2 manual.

Quote
3.4.3 – Coercions and Conversions

Lua provides some automatic conversions between some types and representations at run time. Bitwise operators always convert float operands to integers. Exponentiation and float division always convert integer operands to floats. All other arithmetic operations applied to mixed numbers (integers and floats) convert the integer operand to a float; this is called the usual rule. The C API also converts both integers to floats and floats to integers, as needed. Moreover, string concatenation accepts numbers as arguments, besides strings.

Lua also converts strings to numbers, whenever a number is expected.

In a conversion from integer to float, if the integer value has an exact representation as a float, that is the result. Otherwise, the conversion gets the nearest higher or the nearest lower representable value. This kind of conversion never fails.

The conversion from float to integer checks whether the float has an exact representation as an integer (that is, the float has an integral value and it is in the range of integer representation). If it does, that representation is the result. Otherwise, the conversion fails.

The conversion from strings to numbers goes as follows: First, the string is converted to an integer or a float, following its syntax and the rules of the Lua lexer. (The string may have also leading and trailing spaces and a sign.) Then, the resulting number (float or integer) is converted to the type (float or integer) required by the context (e.g., the operation that forced the conversion).

All conversions from strings to numbers accept both a dot and the current locale mark as the radix character. (The Lua lexer, however, accepts only a dot.)

The conversion from numbers to strings uses a non-specified human-readable format. For complete control over how numbers are converted to strings, use the format function from the string library (see string.format).

Note that I found a small difference and as yet unable to explain it.

My reasoning starts from the position of my first post...a Lua register can hold a value, either integer or float. If you wish to use a register value and apply bit
pattern functions then the bit representation of the register value is critical. From the manual about coercion Lua converts a float to an integer bit pattern
when required. The manual goes on to say that if the float value has an exact integer representation all well and good. If however the float value does not
have an integer value the conversion fails.

I tested this by setting the register to 3.999 and then again to 4.4999 and in both cases Lua coerced the float to integer value 4. It appears then that Lua rounds
a float to an integer value.

Craig

5706
Mach4 General Discussion / Re: Mach4 Lua don't support bitwise operators
« on: December 08, 2017, 05:49:02 PM »
Hi,
I've been experimenting and found this works:

Code: [Select]
function bitpattern()
local inst=mc.mcGetInstance()
local regHand=mc.mcRegGetHandle(inst,'iRegs0/XJogValue')
local XJogValue=mc.mcRegGetValue(regHand)
XJogValue=bit32.bor(XJogValue,0x1)
end
if (mc.mcInEditor()==1) then
    bitpattern()
end

Note that the bitwise function is a library function, bit32.*********x, which is in the Lua 5.2 manual. You're correct, I could not get the "| or &" symbols
to compile with Machs Lua Editor. It is I suspect based on 5.2

https://www.lua.org/manual/5.2/
and the library is:
https://www.lua.org/manual/5.2/manual.html#6.7

Note that I put this into a function so that I could write and edit it and use the debugger to run it. You would have to put it in your signal table.

Craig

5707
Mach4 General Discussion / Re: Mach4 Lua don't support bitwise operators
« on: December 08, 2017, 04:48:13 PM »
Hi,
very intriguing, I can see what you are trying to do but I have some questions.

Code: [Select]
WriteiRegs0 ("JogXValue", GetiRegs0 ("JogXValue") & 0xE) I assume WriteiRegs() and GetiRegs() are functions you have declared eleswhere.
Machs registers can hold Lua values, namely numbers and strings.
A Lua number can be integer or real, there is no distinction between them that I know of. Can you be sure that if JogXValue=3 say, that the bit pattern
stored in the register is 0011 for instance. Until or unless I was sure that the bit pattern is the same as the integer interpretation I would not even be
thinking of bit pattern manipulation.

Have you established that bit patterns stored in the registers behave as integers?

craig

5708
Hi,
signal 'loosendraw', missed that one!

I thought I saw it in a post...the same one that had:

mc.mcSignalGetHandle(inst,'GetMeACupOfCoffe')
mc.mcSignalGetHandle(inst,'AndPeelMeAGrape')

LOL.

Craig

5709
Hi,
I've never tried it so I don't know but its my understanding that what you've written will work.

Craig

5710
Mach4 General Discussion / Re: Mach4 Lua don't support bitwise operators
« on: December 08, 2017, 01:30:09 PM »
Hi,
I haven't used bitwise operators so I can't be definitive but it says in the manual that it can be done so I assume it can be done. What manual did you take
the quote from. I think Lua as shipped with Mach4 is either 5.1 or 5.2 not the latest 5.3.

I have  some experience with Lua  text library functions, searching for, replacing text strings etc. The string functions appear on the surface at least to be
very much cruder than many other languages like Java and Python but they are in fact quite good. All of the standard text manipulation functions can be achieved
with a little creative use of Lua's text functions. The question is 'why did Lua's creators do it this way rather than the Java/Python/C++ standard?'. Surely
Lua would be lambasted with complaints by programmers familiar with the 'standard' text functions.

The reason is code size. To implement the standard text functions would have taken about 9000 lines of code whereas the existing Lua text functions require
500 lines of code. This is a recurring theme in Lua. The functionality appears somewhat limited at first glance but can usually, with some creative programming,
achieve all the functionality of all the serious language contenders and do so with such a small, read miniscule, code footprint. Lua is very clever in this regard
and makes it an excellent choice as a scripting language.

Could you post a sample of your code? I to have had a battle trying to write clean Lua code, the error messages are so terse that they don't really help you
find the syntax fault.

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 »