[etherlab-users] About Beckhoff module EL5151

yangmin yang.min at sibonac.com
Tue Jul 30 05:41:19 CEST 2013


Dear all,

 

         I have a problem in reading Beckhoff module EL5151, are there
anybody can give some help?

         I tried to read the counter value of this module in real time
cycle, but the value was always the same and never followed the input. 

         My code about this module is like this:

 

         static ec_pdo_entry_info_t el5151_pdo_entries[] = {

    {0x7000, 0x01, 1}, /* Enable latch C */

    {0x7000, 0x02, 1}, /* Enable latch extern on positive edge */

    {0x7000, 0x03, 1}, /* Set counter */

    {0x7000, 0x04, 1}, /* Enable latch extern on negative edge */

    {0x0000, 0x00, 4}, /* Gap */

    {0x0000, 0x00, 8}, /* Gap */

    {0x7000, 0x11, 32}, /* Set counter value */

    {0x6000, 0x01, 1}, /* Latch C valid */

    {0x6000, 0x02, 1}, /* Latch extern valid */

    {0x6000, 0x03, 1}, /* Set counter done */

    {0x0000, 0x00, 4}, /* Gap */

    {0x6000, 0x08, 1}, /* Extrapolation stall */

    {0x6000, 0x09, 1}, /* Status of input A */

    {0x6000, 0x0a, 1}, /* Status of input B */

    {0x6000, 0x0b, 1}, /* Status of input C */

    {0x0000, 0x00, 1}, /* Gap */

    {0x6000, 0x0d, 1}, /* Status of extern latch */

    {0x1c32, 0x20, 1}, /* Sync error */

    {0x0000, 0x00, 1}, /* Gap */

    {0x1800, 0x09, 1}, /* TxPDO Toggle */

    {0x6000, 0x11, 32}, /* Counter value */

    {0x6000, 0x12, 32}, /* Latch value */

    {0x6000, 0x14, 32}, /* Period value */

};

 

static ec_pdo_info_t el5151_pdos[] = {

    {0x1600, 7, el5151_pdo_entries + 0}, /* ENC RxPDO-Map Control */

    {0x1a00, 15, el5151_pdo_entries + 7}, /* ENC TxPDO-Map Status */

    {0x1a02, 1, el5151_pdo_entries + 22}, /* ENC TxPDO-Map Period */

};

 

static ec_sync_info_t el5151_syncs[] = {

    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},

    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},

    {2, EC_DIR_OUTPUT, 1, el5151_pdos + 0, EC_WD_DISABLE},

    {3, EC_DIR_INPUT, 2, el5151_pdos + 1, EC_WD_DISABLE},

    {0xff}

};

static unsigned int off_inc_enc;

const static ec_pdo_entry_reg_t domain1_regs[] = {

         .

         IncEncoderA, IncEncoderP, Beckhoff_EL5151, 0x6000, 0x11,
&off_inc_enc}

         .

}

 

int main(int argc, char **argv)

{

         ...

ecrt_slave_config_pdos(sc, EC_END, el5151_syncs) ;

ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs);

...

}

 

void cyclic_task()

{

         int value;

         while(1) {

                                    ..

                   value = EC_READ_U32(domain1_pd + off_inc_enc);

                   ..

         }

}

The value is always the same and never try to follow the input. Can you tell
me where is my problem? Thanks in advance.

 

Best Regards!

Maggie

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20130730/5718ecae/attachment-0002.htm>


More information about the Etherlab-users mailing list