HA26F

            Why are You doing this to me?
            In the name of "copy-paste" (IL, ST, text mode)
			
CoDeSys 2.3 notes
-----------------

H9U6U

Toolbar Buttons:

New Function Block (as x in CircuitMaker) opens menu of available FB's: bistable (RS SEMA SR), counters (CTD CTU CTUD), timers (RTC TON TOF TP), triggers (F_TRIG R_TRIG) programs (SFCActionControl)

CoDeSys words

	ACCUMULATOR is a RESULT
	RUNG        is a NETWORK
	POU         is "Program Organization Unit"
	F2          is the "MAGIC BUTTON"
	
HA26F

Creating POU
~~~~~~~~~~~

File -> New Project
Target Settings
  Default:
  Configuration: 3G CoDeSys SP PLCWinNT V2.4
New POU:
  Program, FBD
Insert:
  Box, F2 -- "name. what box?"
to assign output:
  dotted box to the right of just placed FB-box.
  Insert -> Assign -> ??? -- define VAR dialog.
to create input:
  ??? name of the variable -- define VAR dialog.
to connect input:
  dotted box to the right of ??? input to connect with
  Insert -> Box ..
to invert input or output:
  right click: Negate (Ctrl-N)
HA1JJ

Simulating POU
~~~~~~~~~~~~~

Online -> [v] Simulation mode
Online -> Login
Online -> Run          (F5)
Online -> Write Values (Ctrl-F7)

Visualisation Bind to variable: F2
                      input:    switch or button

H9UN0

Converting Function_Block
~~~~~~~~~~~~~~~~~~~~~~~~

Project .. Object.. Convert (CodeSys2.3)

0. Project: Add new Object -> Function_Block, LD
1. Add new user Function_Block to PLC_PRG
2. Provide some IO Editing VAR_INPUT and VAR_OUTPUT sections
3. Rebuild your Project
4. Convert Function_Block

HA26F

IL - Instruction List
~~~~~~~~~~~~~~~~~~~~

ACCUMULATOR - register (CoDeSys..RESULT)

	LD    load var -> accu
	ST    store accu -> var
	
	S     set variable if DATA is TRUE
	R     reset variable if DATA is TRUE
	
	AND   accu AND var  ; TRUE AND FALSE -> FALSE
	OR    accu OR  var  ; TRUE OR  FALSE -> TRUE
	XOR   accu XOR var  ; TRUE XOR FALSE -> TRUE
	NOT   accu          ; NOT TRUE       -> FALSE
	
	ADD   accu + var    ; 7 + 2 = 9
	SUB   accu - var    ; 7 - 2 = 5
	MUL   accu * var    ; 7 * 2 = 14
	DIV   accu / var    ; 7 / 2 =  3
	MOD   accu % var    ; 7 % 2 =  1
	
	LT    accu < var    ; 7 < 2 = FALSE
	LE    accu <= var   ; 7 <= 2 = FALSE
	QE    accu == var   ; 7 == 2 = FALSE
	NE    accu <> var   ; 7 <> 2 = TRUE
	GE    accu >= var   ; 7 >= 2 = TRUE
	GT    accu > var    ; 7 > 2 = TRUE

	JMP   label
	CAL   name( named args)
	RET


