Hello Guest it is November 14, 2019, 11:12:31 AM

Author Topic: LCD and Macropump help needed  (Read 1662 times)

0 Members and 1 Guest are viewing this topic.

LCD and Macropump help needed
« on: November 16, 2017, 11:46:52 PM »
Hi all, I am new to the forums and hoping to gain some help in relation to displaying data on a 20x4 LCD using macropump.

I agreed to help a friend add additional information to the LCD to make working safer...Mach 3 is running on one PC and the LCD is on the front panel of a slave machine above the mill at the other end of the workstation.

At present we can get the X, Y, Z, and A position data to show on the LCD, as well as measurement units (mm or inches), and whether EStop is triggered or the machine is in Run mode (see attached pic).

We have placeholders (SwR1 and SwR2) which we would like to populate with the following information:

SwR1 - which axis is currently selected in jog mode e.g. X, Y, Z, A
SwR2 - the jog increment e.g. 10mm, 1mm, 0.1mm etc

I have attached the macropump code.

I note from searching the forums that others have been directed to Peter Homann's code for the DIY pendant...I have looked through this and tried to get it working by using relevant parts to no avail.  The attached code is also based on the DIY pendant code.

If someone could please either write some code to get the information to display as needed, or give a thorough explanation that will help I would be grateful...I have been pulling my hair out for nearly 2 weeks now trying various options and believe it is something simple I'm missing but just cannot crack it.  I have a project I am working on that until we sort this I cannot proceed with as it is both a safety issue and will definitely speed working up.

Thanks in advance!
Hopefully perplexed not much longer!!
Re: LCD and Macropump help needed
« Reply #1 on: November 17, 2017, 05:38:35 PM »
Hi,

A couple of things that might help.

1. Run the Macropump and single step through it, checking what is going on.
2. Remove the iCount For Loop for creating the string for the end of the Macropump. Just create the 4 lines as separate statements.

Doing the above should find the problem.

Cheers,

Peter

----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: LCD and Macropump help needed
« Reply #2 on: November 17, 2017, 05:46:05 PM »
My guess is that the error is with these 2 lines.

Code: [Select]
If getOEMLED (16) Then strMode (1) ="  Program " Else strMode (1)  =" SwR1 " 'coord sys Extra Space
If GetOEMLED (83) Then strMode (2) ="     " Else strMode (2) = " SwR2  "

You need to remove the quotes from SwR1 and SwR2

Try

My guess is that the error is with these 2 lines.

Code: [Select]
If getOEMLED (16) Then strMode (1) ="  Program " Else strMode (1)    = SwR1  'coord sys Extra Space
If GetOEMLED (83) Then strMode (2) ="     " Else strMode (2) = SwR2

Cheers,

Peter
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: LCD and Macropump help needed
« Reply #3 on: November 17, 2017, 05:47:41 PM »

My guess is that the error is with these 2 lines.

Code: [Select]
If getOEMLED (16) Then strMode (1) ="  Program " Else strMode (1)  =" SwR1 " 'coord sys Extra Space
If GetOEMLED (83) Then strMode (2) ="     " Else strMode (2) = " SwR2  "

You need to remove the quotes from SwR1 and SwR2

Try


Code: [Select]
If getOEMLED (16) Then strMode (1) ="  Program " Else strMode (1)    = SwR1  'coord sys Extra Space
If GetOEMLED (83) Then strMode (2) ="     " Else strMode (2) = SwR2

Cheers,

Peter
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: LCD and Macropump help needed
« Reply #4 on: November 17, 2017, 06:11:22 PM »
Hi Peter,

Thanks for your input. I'll give your suggestions a go and see what happens. Just a note regarding removing " " around SwR1 and SwR2...I have done this previously but that didn't seem to solve the problem. Hopefully as you suggest stepping through line by line will indicate where I've gone wrong and removing the icount loop in favour of separate statements will also help.

Will post my findings soon.

Cheers
Denyse
Re: LCD and Macropump help needed
« Reply #5 on: November 17, 2017, 08:23:01 PM »
Hi again Peter,

I tried all your suggestions.

1. Stepping through line by line didn't highlight the issue;
2. Removing " " from around SwR1 and SwR2 DID show a value as defined in the macro. These were previously integers so overlooked in the display output string. I have now redefined as strings & can get them both to display as needed.
3. The above was highlighted more by removing the icount loop and running as separate statements as suggested. To test I ran either SwR1 or SwR2 without any other info being displayed then have combined to display all required info once I knew each was working separately.  Now I just have to hard code the formatting.

Thanks so much for your help. I knew I wasn't far off but just needed a little pointer. My resulting code is currently in no way elegant but it works!

Thanks again  :)

Cheers
Denyse