Page 1 of 1

Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Tue May 14, 2019 3:17 pm
by rustfinger
Hello,

I am adding an ADD4AD4DA to a new ALLIN1DC install. It is all new setup and there are several things that needed to be added/removed or modified to the PLC program. Everything is going well so far, except I have run into an issue with adding the ADD4AD4DA board.

Rather than explain all the details in this message, I attached the Report file, the modified PLC source code (incomplete), a text file roughly explaining the project and a few images of my questions.

So here is the main questions/issues:

Question #1)
While adding the ADD4AD4DA, I noticed that I need to enable the "MiniPLCBus Checking" (page 38 of the PLC Programming manual).

It says I need to add the following:

;add to constant defines
MINI_PLC_1_FLT_MSG IS (1+256*60); 15361

However in the existing source file there is the line:
MINI_PLC_1_FLT_MSG IS 39169;(1+256*153)
CONSTANTS.JPG
But, in the message file (plcmsg.txt) the error message for this fault is numbered 9153.

So the question I have is: which line above is correct? or... should it be the same as the message # in the text file? Such as:
MINI_PLC_1_FLT_MSG IS 9153;(193+256*35)


Question #2)
In the same section of the manual (page 38) (I also posted a screenshot showing the section) there are the following lines:

;check the first Expansion board
IF 1==1 THEN BITTST SV_PC_MINI_PLC_ONLINE 0 ADD1616ok1_M
IF !ADD1616ok1_M && PLCBus_Oe_M THEN
ErrorCode_W = MINI_PLC_1_FLT_MSG, SET SetErrorStage, SET PLCFault_M
QUESTION1.JPG
However, there is no variable (memory bit) with the name "ADD1616ok1_M" (or ADD4AD4DAok1_M or anything similar).
But I did find "MiniPLCOk1_M".

So The 2nd question is:

Should I modify the lines to read:
IF 1==1 THEN BITTST SV_PC_MINI_PLC_ONLINE 0 MiniPLCOk1_M
IF !MiniPLCOk1_M && PLCBus_Oe_M THEN
ErrorCode_W = MINI_PLC_1_FLT_MSG, SET SetErrorStage, SET PLCFault_M

That would be my guess, but I am not sure. (It takes a long time to debug my guesses😒)


One last Question (this was the next post I was going to make):
In my attached text file "Change Summary.txt" which describes what I am trying to do, I show the spindle speed memory bits (12 output bits on the ALLIN1DC) being 're-mapped' to the ADD4AD4DA (16-bit) memory bits. I think I can figure out the math for this, but I don't think I have the correct location of where those bits are located. The mpu_info.txt file shows the output bits as Outputs 257-272, 273-288,289-304 and 305-320. You can see in my .src file I have them mapped as Outputs 17-32, 3-48 and 49-64 which I don't think will work. Do I need to use the Outputs listed in the mpu_info.txt file for the Outputs?

I apologize if this seems like a zillion questions😵, I tried to condense it down to the most critical issues.😁

Thanks for your Help!

Re: Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Wed May 15, 2019 12:00 pm
by rustfinger
I think I found the solution to my last post questions.

This is what is working for the PLC programming to install the ADD4AD4DA board:

So this is what I thought would work:


IF 1==1 THEN BITTST SV_PC_MINI_PLC_ONLINE 0 MiniPLCOk1_M
IF !MiniPLCOk1_M && PLCBus_Oe_M THEN
ErrorCode_W = MINI_PLC_1_FLT_MSG, SET SetErrorStage, SET PLCFault_M


But I found that there is no longer (at least in my ALLIN1DC PLC program version called 'Centroid-Standard-Mill-r4.src') a variable called 'ErrorCode_W' nor is there a 'stage' called 'SetErrorStage'.
The variable I found was 'ErrorMsg_W', and the 'stage' name that appears to handle expansion board errors is 'MiniPLCErrorStage'.

So the code that would be the answer to my second question in the last post becomes:


IF 1==1 THEN BITTST SV_PC_MINI_PLC_ONLINE 0 MiniPLCOk1_M
IF !MiniPLCOk1_M && PLCBus_Oe_M THEN
ErrorMsg_W = MINI_PLC_1_FLT_MSG, SET MiniPLCErrorStage, SET PLCFault_M

(I hope this is correct, is seems to compile and work properly so far)

As for the last issue with the Outputs on the ADD4AD4DA board, I revised the output #'s to show what was listed in the 'mpu_info.txt' file and the next steps are to test the outputs (as Outputs 257-272, 273-288,289-304) to be sure they work, after that I have to figure out how to map the spindle speed to the new outputs.

Hopefully this post will help others in the same situation.

Thanks!

Re: Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Wed May 15, 2019 2:14 pm
by cncsnw
The code to check for errors is already in the source file you posted.

See lines 2554-2557 near the end of CheckCycloneStatusStage.

If you have one PLC expansion board connected, then you should set Parameter 900 = 1, to tell the PLC to expect and require it.

On other notes:
1) It is better to use MEM bits when you need a memory bit, not OUT bits (Centroid's "ResetSet" notwithstanding).
2) Assign meaningful names to the default tokens (e.g. OUT5, OUT6, OUT7), then use them. Don't use the default token names in your logic.
3) There are no rigidly standardized numbers for mini PLC communication fault and warning messages. As long as your plcmsg.txt file matches your source file, then the correct message text will appear.

Re: Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Wed May 15, 2019 4:18 pm
by CarlPLC
In your program, FaultMsg_W would take the place of ErrorCode_W, and SetErrorStage will be ShowErrorStage

Re: Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Wed May 15, 2019 6:55 pm
by rustfinger
cncsnw wrote: Wed May 15, 2019 2:14 pm The code to check for errors is already in the source file you posted.

See lines 2554-2557 near the end of CheckCycloneStatusStage.

If you have one PLC expansion board connected, then you should set Parameter 900 = 1, to tell the PLC to expect and require it.

On other notes:
1) It is better to use MEM bits when you need a memory bit, not OUT bits (Centroid's "ResetSet" notwithstanding).
2) Assign meaningful names to the default tokens (e.g. OUT5, OUT6, OUT7), then use them. Don't use the default token names in your logic.
3) There are no rigidly standardized numbers for mini PLC communication fault and warning messages. As long as your plcmsg.txt file matches your source file, then the correct message text will appear.
Do the lines 2554-2557 do the SAME as what I added?

Thanks for your Help!

Re: Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Wed May 15, 2019 6:58 pm
by rustfinger
CarlPLC wrote: Wed May 15, 2019 4:18 pm In your program, FaultMsg_W would take the place of ErrorCode_W, and SetErrorStage will be ShowErrorStage
I changed the names to what you replied and it is working. I am wondering if the previous post which says that the lines 2254-2257 already has the error checking will be sufficient or if I need the one I added as well?

Any thoughts?

Thanks for your Help!

Re: Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Wed May 15, 2019 11:48 pm
by cncsnw
You don't (didn't?) need to add any extra lines to test for mini PLC communication errors. That is what the existing code is there for.

Also, FaultMsg_W in current (post-2011) programs is not exactly the same as ErrorCode_W in pre-2011 programs. In cases where you do need to add Faults, Errors, or Warnings (not this case, because you don't need to add anything) follow the guidelines here: http://www.cncsnw.com/PLCApplicationsMPU11.htm.

Re: Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Thu May 16, 2019 11:44 am
by rustfinger
Thanks for the reply, I will remove the added lines and re-compile.

Today I need to finish mapping the spindle speed info from the 12-bit DAC output variable on the ALLIN1DC to the DAC's on the ADD4AD4DA.

One question I have is: If the PLC program is checking to see which spindle is active, and then writing the results (bits) to the OUT bits and also converting and then writing the DAC speed results (more bits) to the ADD4AD4DA OUTPUTS, will the PLC be overloaded and bogged down when we start running programs? Especially since all of these actions are in the 'main stage'.

I mean, should I consider creating a separate stage that only runs at longer intervals, controlled by a timer, as some of the other stages seem to be set up? Or... is the PLC fast enough so that this won't be an issue?

Thanks Again!

Re: Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Thu May 16, 2019 12:35 pm
by CarlPLC
Given the computer specs, the runtime impact should be negligible since we are looking at bit-level operations. It's more a matter of how complex your PLC commands are using the new IO.

Re: Adding an ADD4AD4DA board to an ALLIN1DC controller

Posted: Thu May 16, 2019 6:33 pm
by rustfinger
Well, the ADD4AD4DA is really only acting as an way to provide 0-10v to 3 separate spindle VFDs. The old control for this machine used a relay board to select the VFD to use and just daisy chained the 0-10v. However the voltage was reduced to 9.7v and none of the spindles would run at full speed. Doing it this way might be overkill, but its working.

Thanks for your help!