CANopen Slave Documentation
Version 6.16.04
Loading...
Searching...
No Matches
cos401di.h File Reference

Detailed Description

This module implements the variables and callback functions for the object dictionary from CiA 401 (digital inputs). The module adds the following objects to the object dictionary:

Index Description Function / Variable Configuration Symbol
6000h Read input 8-bit Cos401_Idx6000() COS_DS401_DI
6002h Change polarity input 8-bit Cos401_Idx6002() COS_DS401_DI
6005h Global interrupt enable Cos401_Idx6005() COS_DS401_DI
6006h Interrupt mask any change 8-bit Cos401_Idx6006() COS_DS401_DI
6007h Interrupt mask Low-to-High Cos401_Idx6007() COS_DS401_DI
6008h Interrupt mask High-to-Low Cos401_Idx6008() COS_DS401_DI
+ Include dependency graph for cos401di.h:

Functions

uint8_t Cos401_DI_PdoSend (uint8_t ubGroupV)
 
uint8_t Cos401_DI_Read (uint8_t ubGroupV)
 
void Cos401_DI_Set (uint8_t ubGroupV, uint8_t ubValueV)
 

Function Documentation

◆ Cos401_DI_PdoSend()

uint8_t Cos401_DI_PdoSend ( uint8_t  ubGroupV)
Parameters
ubGroupVinput group number
Returns
1 if PDO transmission is requested

The functions returns 1 if a PDO transmission is requested, otherwise 0.

◆ Cos401_DI_Read()

uint8_t Cos401_DI_Read ( uint8_t  ubGroupV)
Parameters
[in]ubGroupVinput group number
Returns
value of digital input block

This function returns the actual state of a digital input block defined by ubGroupV and sends a PDO if the state has changed. The parameter ubGroupV defines the zero based group number.

◆ Cos401_DI_Set()

void Cos401_DI_Set ( uint8_t  ubGroupV,
uint8_t  ubValueV 
)
Parameters
[in]ubGroupVinput group number
[in]ubValueVdigital input value

This function sets the actual value of the input ports. The parameter ubGroupV denotes the group number. The first group of 8 digital inputs starts at index 0 (i.e. sub-index - 1 of object 6000h). This function needs to be called from the application code (e.g. interrupt handler, main loop) in order to setup the value for the digital inputs.

Example

main()
{
uint8_t ubDigitalInputValueT;
....
while(1)
{
//------------------------------------------------
// this is the central main loop, which reads
// the value of the digital inputs
//
ubDigitalInputValueT = MyInputReadFunction()
//--- pass this value to the stack ---------------
Cos401_DI_Set(0, ubDigitalInputValueT);
....
}
}
void Cos401_DI_Set(uint8_t ubGroupV, uint8_t ubValueV)