Stuck with Twincat NCI

tevious

Member
Join Date
Feb 2015
Location
Balingen
Posts
22
Hello I try to simulate a 3D axis with Twincat (3) NC I and for now I'm stuck.
I use TC3 but there are lot of documents for TC2 so I started by this point:
http://infosys.beckhoff.com/english.php?content=../content/1033/tcnci/plclibconfiguration/html/TcPlcLibNcCfg_CfgBuild3DGroup.htm&id=

Unfortunately, I cannot open the samples with TC3 and in FB some inputs/outputs changed.

At the final step of the project, the 3 axis robot will receive positions data from external source (so for us it will be through ADS I guess) and will have to build and follow this path.

For now, I just tried to make a single line and to run it once.
I want to check my result through a scope project with ActPos of differents Axis (I made it with a small PTP 1 axis project last week with success).
Unfortunately, it's very hard to manage it because there are so much things to do and without guideline I can't figure out...

Here follows my source code if someone could have a look, I'd appreciate a lot!
Thanks

In NC / Motion I defined 3 axis (X,Y,Z) with Id = 1 to 3
I defined too a NC-Channel in this part with 1 group (group 4) and its Id = 4.

In PLC, references added: Tc2_NCI and Tc2_PlcInterpolation

GVLs:
VAR_GLOBAL
start AT %I* : BOOL; // Not used before HMI's design
done : BOOL := FALSE;
gstart : ST_NciGeoStart; // plc-g-code block to start
glinie : ST_NciGeoLine; // plc-g-code block to do one simple line
fbFeedTablePrep : FB_NciFeedTablePreparation;
fbFeedTable : FB_NciFeedTable;
configGroup : CfgBuild3DGroup;
entries : ST_NciFeedGroupTable;
entriesgrouptable : ST_NciFeedGroupTable;
c2p : NCTOPLC_NCICHANNEL_REF;
END_VAR

===========================
My only POU (no variables) with MAIN: gcodeprog (PRG)

IF done = FALSE THEN
// Config:
configGroup.nXAxisId := 1;
configGroup.nYAxisId := 2;
configGroup.nZAxisId := 3;
configGroup.nGroupId := 4;
configGroup.bExecute := TRUE;
// init Position:
gstart.fPosX := 0;
gstart.fPosY := 0;
gstart.fPosZ := 0;
// prep init config:
fbFeedTablePrep(
nEntryType := E_NciEntryTypeGeoStart,
pEntry := ADR(gstart),
bResetTable:= FALSE,
stFeedGroupTable := entriesgrouptable,
nFilledRows=>,
bError =>,
nErrorId =>);
// A simple Linie:
glinie.nDisplayIndex := 1;
glinie.fEndPosX := 200;
glinie.fEndPosY := 400;
glinie.fEndPosZ := 100;
glinie.fVelo := 100; (*mm per sec*)
// prep simple Linie:
fbFeedTablePrep(
nEntryType := E_NciEntryTypeGeoLine,
pEntry := ADR(glinie),
bResetTable:= FALSE,
stFeedGroupTable := entriesgrouptable,
nFilledRows=>,
bError =>,
nErrorId =>);
// Run the program:

fbFeedTable
(stFeedGroupTable := entriesgrouptable,
stNciToPlc := c2p,
bExecute := TRUE
);

// We want to run this program only once
done := TRUE;
END_IF

========================================

and the main:

gcodeprog(); // loop and loop again...
 

Similar Topics

Hello, I'm learning TC3 and try to make a traffic light as training. But, I'm stuck, I don't know why it doesn't work, The sequence is really...
Replies
6
Views
3,862
Hi, I am using M221 reading from 3 different sensors (modbus rs485) sharing same bus (daisy chain). I am currently using READ_VAR (in total...
Replies
0
Views
103
I'm using one TON (called SystemTimer) throughout a program that I change the .PRE given different conditions. I'm porting an IDEC ladder over to...
Replies
8
Views
333
We have a keg check weigher that that lost a fight to a forklift. The scale was previously a Systec IT3000, which was the only PROFIBUS slave...
Replies
5
Views
697
really strange issue. The panelview(2711p-T10C22D9P) will try to load an application and get stuck on "Starting Alarms". If I reboot the...
Replies
4
Views
1,484
Back
Top Bottom