Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

pdo.c File Reference

#include <pdo.h>
#include <def.h>
#include <objacces.h>
#include <general.h>
#include <canop.h>
#include <objdict.h>
#include <init.h>

Data Structures

struct  sd_pdo_transmit_transfer_table

Defines

#define FILL_DATA   0, 0, 0, 0, 0
#define FILL_IN_DATA   0, 0, 0, 0, 0, 0, 0, 0
#define FILL_IN_MESSAGE_DATA   0, 0, 0, 0

Typedefs

typedef sd_pdo_transmit_transfer_table s_pdo_transmit_transfer_table

Functions

void CopyBits (int NbBits, char *SrcByteIndex, int SrcBitIndex, BOOL SrcLittleEndian, char *DestByteIndex, int DestBitIndex, BOOL DestLittleEndian)
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)

Define Documentation

#define FILL_DATA   0, 0, 0, 0, 0
 

#define FILL_IN_DATA   0, 0, 0, 0, 0, 0, 0, 0
 

for the next two vars: adjust the count of lines according to the value of MAX_COUNT_OF_PDO, to avoid unexpected things...

#define FILL_IN_MESSAGE_DATA   0, 0, 0, 0
 


Typedef Documentation

typedef struct sd_pdo_transmit_transfer_table s_pdo_transmit_transfer_table
 

some data definitions


Function Documentation

void CopyBits int    NbBits,
char *    SrcByteIndex,
int    SrcBitIndex,
BOOL    SrcLittleEndian,
char *    DestByteIndex,
int    DestBitIndex,
BOOL    DestLittleEndian
 

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