Hello Guest it is April 20, 2024, 10:14:48 AM

Author Topic: SERIAL INPUT AND BRAINS  (Read 6840 times)

0 Members and 1 Guest are viewing this topic.

SERIAL INPUT AND BRAINS
« on: January 21, 2008, 12:21:52 PM »
Still new to all this.
The second hand cnc machine I have has push buttons for jogging. I would like to use these in Mach3. Am I right in thinking I have three main options?
1) Buy a parallel port card which can be configured for approx a dozen more inputs.
2) Buy an expensive modbus interface with everything done for me.
3) Make my own rs232 interface, communicating through the Serial Monitor.

Option three would be my preferred option as I would easily be able to programme an AVR to monitor switches and send and receive data. This would turn out very cheap for me and would be available for more sophistication on both inputs and outputs as I get more used to milling and time becomes available.
Is there an rs232 buffer in Mach3 that is accessible from Brains, and if so, where would I find information on it?

TIA


Dave

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: SERIAL INPUT AND BRAINS
« Reply #1 on: January 21, 2008, 03:35:10 PM »
currently, you can only send OUT infomation on "Send Serial" type stuff. You cant read a serial port, directly.

Currently you options are for getting control inputs: second parallel port, Keygrabber, PLC's, Peters Mod IO board, Aurturos Mobus board(s), and cube logic that I am aware of.

scott
fun times
Re: SERIAL INPUT AND BRAINS
« Reply #2 on: January 22, 2008, 04:48:22 AM »
Thanks Scott, somewhere to start.
So, presumably, I could send out a simple byte to read row one, get my AVR to connect that row to logic 0, then read that row of four or five inputs on the second parallel port. This would enable as many switches as the timing cycle would allow. I am thinking of such things as preset jog rates, spindle stop/start etc. This could also lead to a 4 x 16 lcd character display of DROs.

The last parallel port card I bought cost less than 17GBP and the cost of an AVR board is down to time mainly.

So unless any of the other options are more sensible for me and assuming there are no problems with my plan A, I'll start experimenting. I get the feeling that the send serial part of the excercise would need to be executed by a macro pump and visual basic?

Thanks again


Dave
Re: SERIAL INPUT AND BRAINS
« Reply #3 on: January 26, 2008, 07:15:34 AM »
As an update to this, I dismantled a usb joystick, connected the external switches and used keygrabber. I can now jog from these external switches. I have also routed some of the spare joystick switches to oemtriggers. What I want is to have three switches with preset jog rates, 4%,40% and 100%.  I have checked that the oemtriggers are working by using one to turn jog mode on and off. I have also written a one line macro that puts 4% in the oemdro (number 3) and that works. What I have not been able to do is combine those two processes so that pushing the external switch alters the slow jog rate. I suspect that oem 277 may be involved but I can't figure how. I have now started trying to use a brain, but I still can't find the way of loading a dro with a value.
One of my problems is that my access to broadband is at work but the machine is at home. So I have to watch the videos at work and try to remember them when I get home.
If anyone can help with this final problem that should keep me quiet for a whille.

Dave
Re: SERIAL INPUT AND BRAINS
« Reply #4 on: January 26, 2008, 09:28:28 AM »
Hi Dave,


2) Buy an expensive modbus interface with everything done for me.


who told you that Modbus have to be expensive ?
I'm using on 3 machines CubLoc CB280 and I'm glad what this device will do :-)

An additional LPT costs roundabout 10$, and you're limited in number of ports - so the 30 oder 40$ for a PLC are nearly related

Frank
Re: SERIAL INPUT AND BRAINS
« Reply #5 on: January 26, 2008, 11:50:07 AM »
Initially I looked on Google and all the modbus interfaces seemed to be around $100 or more. But that is academic now as I have the joystick working the jog controls and am within a whisker of achieving everything I'm after. I just need to marry up an oemtrigger to a piece of code.
On looking further, I notice that there appears to be a discrepancy between what it says in the customizing pdf and the drop down box for buttons in the brains termination dialogue. In customizing, oem code 277 is said to be the trigger for oemtriggermacro to run, so that is what I put in system hotkeys. In brains, oem code 277 is shown as feedrate++, and that is what happens when I press my joystick switch. But I can't find anything in brains to give me oemcode to trigger the macro.

Dave
Re: SERIAL INPUT AND BRAINS
« Reply #6 on: January 28, 2008, 05:40:25 AM »
I now have everything working as required, but using a macro pump not brains. I have to say that help for this Mach system is very fragmented, and often out of date. I found a function 'isactive()' from a forum post. The customize pdf gives oemtriggers 1 to 3 as signals 29 to 31 but nothing for 4 and above. I took a chance on 4 being 32 etc. and that worked. Oh to be able to click on help and find an alphabetical list of subs and functions with syntax and examples.


Dave