Activate outputs manually

If you have a question about the software please ask it here.

Activate outputs manually

Postby Jotape » Tue Dec 22, 2020 8:14 pm

Hi folks!
I'm doing an old Bridgeport 520 interact retrofit with full cncdrive hardware and software.
My question is, is there anyway to activate the outputs manually? Not running a macro.
I'm doing some test with the pneumatic ATC sistem and I need to activate the solenoids one by one to test and check all of them.

Thanks a lot guys!
Jotape
 
Posts: 2
Joined: Tue Dec 22, 2020 7:53 pm

Re: Activate outputs manually

Postby dezsoe » Wed Dec 23, 2020 9:52 am

You can use the following macro. Save it to Mxxx.txt into your macro folder, where xxx is a number that already does not exist. (You can safely use 1000..)

Code: Select all
if ((Evar == null) || (Hvar == null) || (Qvar == null))
{
  exec.AddStatusmessage("Parameters: E<port> H<pin> Q<0|1>");
  return;
}

int Eint = Convert.ToInt32(Evar);
int Hint = Convert.ToInt32(Hvar);
int Qint = Convert.ToInt32(Qvar);

if (Qint == 0)
  exec.Clroutpin(Eint, Hint);
else
  exec.Setoutpin(Eint, Hint);

E.g.: M1000 E1 H17 P1 will turn on port 1 pin 17.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Activate outputs manually

Postby Jotape » Wed Dec 23, 2020 1:34 pm

Thanks a lot Csaba!

For a real noob in Macros and programming, can someone explain more or less what each command will do?
I need to start to understand this things, I have an ATC project in front to program
Jotape
 
Posts: 2
Joined: Tue Dec 22, 2020 7:53 pm

Re: Activate outputs manually

Postby dezsoe » Wed Dec 23, 2020 1:51 pm

Code: Select all
if ((Evar == null) || (Hvar == null) || (Qvar == null))
{
  // if any of the parameters is missing then give error message
  exec.AddStatusmessage("Parameters: E<port> H<pin> Q<0|1>");
  return;
}

// convert the double type values to integer, because the pin switching functions
// work with integer parameters
int Eint = Convert.ToInt32(Evar);
int Hint = Convert.ToInt32(Hvar);
int Qint = Convert.ToInt32(Qvar);

// if Qint = 0 then turn off with Clroutpin(port, pin) else turn on with Setoutpin(port, pin)
if (Qint == 0)
  exec.Clroutpin(Eint, Hint);
else
  exec.Setoutpin(Eint, Hint);

The double? type is a special type of floating point: it can be null if no value is assigned to it, so you can check if the macro was called with the required parameters. See the manual 4.1.2 M-codes.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Activate outputs manually

Postby sebba » Wed Dec 23, 2020 3:31 pm

Hello again,

I checked for "if (myEvar == null)" before and after #Events
Before #Events myEvar have desired value but after #Events it is null ^%$#@@%$$#@@&****

Thank you,
Seb
- YQWQ
User avatar
sebba
 
Posts: 53
Joined: Mon Dec 21, 2020 9:56 am
Location: Bucharest, ROMANIA

Re: Activate outputs manually

Postby dezsoe » Wed Dec 23, 2020 3:51 pm

I replied in your topic.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Activate outputs manually

Postby sebba » Wed Dec 23, 2020 4:12 pm

ops, sorry for posting here... my fault... back to my topic
- YQWQ
User avatar
sebba
 
Posts: 53
Joined: Mon Dec 21, 2020 9:56 am
Location: Bucharest, ROMANIA


Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 41 guests