Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

pdo.h File Reference

Responsible for PDO transfers (rx and tx). More...

#include <canop.h>
#include <def.h>
#include <objdict.h>

Go to the source code of this file.

Data Structures

struct  td_s_pdo_receive_transfer_table
struct  td_s_variable_mapping

Typedefs

typedef td_s_variable_mapping s_variable_mapping
typedef td_s_pdo_receive_transfer_table s_pdo_receive_transfer_table

Functions

void processSendPDO (void)
void processReceivedPDO (s_rx_buffer_message *canopenMessage)
void sendPDO (const WORD wID, const BYTE *pbData, const BYTE bLength, const BOOL bRemoteReceive)
BOOL resetTxPDOData (BYTE bPDONr)


Detailed Description

Responsible for PDO transfers (rx and tx).

This file contains functions for receiving and transmitting PDOs.

Warning:
Only PDOs with transfertype 255 (submit/receive on change) are implemeted at the moment.

Typedef Documentation

typedef struct td_s_pdo_receive_transfer_table s_pdo_receive_transfer_table
 

Struct to store received PDOs.

typedef struct td_s_variable_mapping s_variable_mapping
 

this struct is only for the receiving transfer-table. it is needed because of the different mapping parameter for one pdo. this means: one pdo (up to 64bit) can mapp the value on different variables e.g.: the value of bit 1 is for bit 1 of the variable UINT8 led1; and the value of bit 14 is for the variable UINT8 led12;


Function Documentation

void processReceivedPDO s_rx_buffer_message   canopenMessage
 

This function should be called in every while-loop of the operational( )-function (file app.c). It is responsible to analyse incoming PDO messages. Therefore it sets local variables to the received values if there are some rx-PDOs defined. only transmissiontype 255 (0xFF) is supported yet.

Parameters:
canopenMessage  contains the CAN-Message that has arrived.

void processSendPDO void   
 

Sends PDO (if any data has changed) to other CANopen devices. Only transmissiontype 255 (0xFF) is supported yet. This function has to be called every time a PDO has changed and should be sent to foreign nodes. So you should either call this function in interrupt service routines, which modifies PDOs or in the while-loop in the operational( )-function (in file app.c)

BOOL resetTxPDOData BYTE    bPDONr
 

At the moment the SlaveLib can only handle PDOs with transmissiontype 255. It sends PDOs and stores the values in the struct called TxPDOTransferTable. Therefore, if the next time processSendPDO is called, it checkes wheter the values have changed since last sending of a PDO or not. If the lether is the case, no data are sent. For some programs it is useful to always send a message due to several reasons. Therefore this function sets the previous stored data to invalid, so the function processSendPDO sends the new data (that may contain the same data as sent before) out to the CAN-Bus.

Parameters:
bPDONr  the number of the PDO. (normally 1..4, maybe also greater than 4)
Returns :
TRUE if successful, false if the operation failed.

void sendPDO const WORD    wID,
const BYTE *    pbData,
const BYTE    bLength,
const BOOL    bRemoteReceive
 

sends a PDO message to the CANopen device with the id bID and the data defined by the m

Parameters:
bID  ID of the PDO (not ID of the CANopen device!)
pcData  Pointer to the BYTE array (maximum length 8 Byte)
bLength  Length of the data (count of valid fields of the pbData array)
bRemoteReceive  TRUE for asking a device to send us this pdo, FALSE for sending a PDO to an other CANopen device


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