My FANUC is configured to be a static IP on 192.168.2.10
I wrote a simple python server to listen for connections and echo messages. It is running on 192.168.2.5 on port 8000.
I went through the client tag set up from the KAREL manual. Tag C1 looks like:
C1 SM 192.168.2.5 DEFINED
System Variable $HOST_CFG[1] looks like:
$PROTOCOL 'SM'
$PORT '8001'
..
$SERVER_PORT '8000'
My test client code looks like:
Code
PROGRAM kc
%STACKSIZE = 4000
%NOLOCKGROUP
%NOPAUSE=ERROR+COMMAND+TPENABLE
%ENVIRONMENT uif
%ENVIRONMENT sysdef
%ENVIRONMENT kclop
%ENVIRONMENT bynam
%ENVIRONMENT fdev
%ENVIRONMENT flbt
%INCLUDE klevccdf
%INCLUDE klevkeys
%INCLUDE klevkmsk
VAR
file_var : FILE
tmp_int : INTEGER
tmp_str : STRING[128]
status : INTEGER
entry : INTEGER
loop1 : BOOLEAN
BEGIN
SET_FILE_ATR(file_var, ATR_IA)
SET_VAR(entry, '*SYSTEM*', '$HOST_CFG[1].$SERVER_PORT',8000,status)
WRITE(' VAR status = ',status,CR)
-- Connect the tag
WRITE('Connecting...',CR)
MSG_CONNECT('C1:',status)
WRITE(' Connect status = ',status,CR)
loop1 = TRUE
END kc
Display More
I am able to load the program, and run it, but it throws an error:
INTP-320 (KC,29) Undefined built in
and that line points to MSG_CONNECT('C1:',status).
On the user screen I see
VAR status = 16006
Connecting...
What am I doing wrong in the communication setup?