kl800.com省心范文网

2_CoDeSysV23_training_practice_图文

CoDeSys
Controller Development System Part II Practice

Topics
● ● ●

Memory layout of a controller running CoDeSys Preparing a controller Communication with the Controller – Communication checklist Starting a new application Running and debugging Inputs and Outputs – Analogue
– –

● ● ●

Digital PWM Regulation

● ● ●

CAN Communication EEPROM Libraries

Memory Layout of a Controller Running CoDeSys

Flash ROM Boot loader Run Time System

Log In Application

RAM User Application

Preparing a Controller Overview
Flash ROM Boot loader Run Time System Winflash

Log In Application

RAM User Application CoDeSys IDE

'Flashing' the User Application ?Create Boot Project“
Flash ROM Boot loader Run Time System Flash ROM Boot loader Run Time System

Log In Application

User Application

Hex File

RAM User Application

RAM User Application

Preparing a Controller Winflash – Run Time System



DLL and hex file Power to controller CAN connection Search local ID Company ID Bitrate IEC1131 RTS Flash with Local ID Cycle power!

















Preparing a Controller Winflash – Log In Application

IDE Communication Overview

IDE Communication Configuration

IDE Communication Checklist
● ● ● ● ●

Project for the specific controller Login Type - CAN_FF Communication Parameters - CAN_FF Node Number 100 (Not the CAN Node ID!) Log In
– –

Reset the controller Log In ... Download New Program? (to RAM!)



Doesn't Work?
– –

Rebuild the project (ROM/RAM specific) Check the Troubleshooting page!

Starting a New Application


?New From Template“ IDE Communication!



Starting a New Application What's In the Template



firstcycle Relay Watchdog





Starting a New Application D+

Starting a New Application I/O Configuration


I/O Parameters – e.g. Type I/O Address %IW, %QW



Label Interrupt flanks





Input/Output Signals Analogue Inputs


By Label By Function block Global Channel Defines See ESX_help
– –







Pin numbers Channels

Input/Output Signals Analogue Inputs - Result

Input/Output Signals Digital Input

Input/Output Signals Digital Output - Configuration

Input/Output Signals Digital Output - Measure the Current

Input/Output Signals Digital Output - Result

Input/Output Signals PWM Output

Input/Output Signals PWM Output - Result

Input/Output Signals Regulation
From the Interrupt Example (Standard Examples) Regulator runs in a 10ms task, immediate update with FB_SET_DIGOUT

Input/Output Signals Regulation - Result

CAN Communication

● ● ● ●

First 2 CAN objects of CAN0 are reserved (IDE Communication) In a KEFEX Project, 2 more objects are reserved (user specified) Debugging and monitoring won't work on one CAN interface Use caution when changing the bit rates

CAN Communication Example - Configuration

CAN Communication Example - Send

CAN Communication Example - Result

CAN Communication Example – Request Protocol

CAN Communication Example Result

EEPROM Function Block

First usable address is 256. Size from the the System Variable tEsxSys.bEESize Limited life (Maximum number of cycles)

EEPROM Example Declarations

EEPROM Example

Typical EEPROM Use


Read EEPROM into a RAM STRUCT at startup If no valid values, use defaults Normal access via RAM Write cyclically (in case of power fail), and, Write back to EEPROM at shutdown









Building a Library

● ● ● ●

Start a new project Create objects Save as internal library Use a password to protect the contents

More Infomation



STW CoDeSys Help file – Libraries
– –

Function Blocks System Variables, etc



CoDeSys User Manual – Programming, Syntax, IDE, Tools Controller Help files – Details of Hardware




Details of functionality: I/O, EEPROM



Library Manager – Function block interface

Any questions?
Thank you for attention


2_CoDeSysV23_training_practice_图文.pdf

2_CoDeSysV23_training_practice - CoDeSys

3_CoDeSysV23_training_RAMView_图文.pdf

● ● ● In Practice: CoDeSys ● Import the RAMView project into CoDeSys...2_CoDeSysV23_training_... 37页 5下载券 4_CoDeSysV23_training_... ...