Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

app.h File Reference

Contains the user-code. More...

Go to the source code of this file.

Defines

#define FOSC   4000

Functions

void stopped (void)
void preOperational (void)
void operational (void)
void initialisation (void)
void InterruptHandlerHigh (void)


Detailed Description

Contains the user-code.

This file contains the user-code. Therefore the user has to put his c-code into the correct state-machine functions.


Define Documentation

#define FOSC   4000
 

This define is important especially for microcontrollers: it tells the slavelib the CPU speed. This is neccessary for setting up timers for heartbeat and the CAN controller (baudrate setting)


Function Documentation

void initialisation void   
 

This function is called automatically by the statemachine, when the microcontroller powers up. after execution of this function the state machine automatically changes into pre-operational state. So don't make loops here (while( getState( ) == INITIALISATION_NODE) )

void InterruptHandlerHigh void   
 

void operational void   
 

The statemachine calles this function, if a NMT message was received from the NMT master that tells this node to change into operational state. in this state the CANopen device sends/receives PDOs and all other message types (but not: Boot-Up Object and LSS Objects) this function must contain a while-loop like this: while( bStateMachineState == OPERATIONAL ) { // because sending of heartbeat must start just after bootup, lets do that... processLifeGuard( ); proccessRxCanMessages( ); // user defined code follows here (or somewhere else in the while-loop) }

void preOperational void   
 

This function is called automatically by the statemachine, when the microcontroller powers up. after execution of the function initialisation the state machine changes into pre-operational state. In this function you have to loop with a while-loop: while( bStateMachineState == PRE_OPERATIONAL ) { // because sending of heartbeat must start just after bootup, lets do that... processLifeGuard( ); proccessRxCanMessages( ); }

void stopped void   
 

This function is called, when a remote node tells this node to stopp this node. in this state, no SDO, no PDO, no SYNC, no Time stamp, no emergency messages are allowed to send/receive --> only NMT, LSS, and (in some cases) Error control Objects can be processed In this function you have to loop with a while-loop: while( bStateMachineState == STOPPED ) { // because sending of heartbeat must start just after bootup, lets do that... processLifeGuard( ); proccessRxCanMessages( ); }


Generated on Wed Dec 25 01:04:57 2002 for CANopen SlaveLib by doxygen1.2.17