下边是IGH的 mail list。大意就是使用ecrt_slave_config_reg_pdo_entry()来代替ecrt_slave_config_pdos()来进行注册。
Hi Christian!
Instead of passing the structs to ecrt_slave_config_pdos(), you can use
ecrt_slave_config_reg_pdo_entry() to register each PDO individually. This
function has an optional parameter to get the bit position. With this provided
it won't complain about byte alignment.
It also seems to work to only register the first PDO entry, and you get access
to the other entries that share the same byte. I think this is the way it is
done in the digital IO examples.
Best regards,
Fabian Herb
Am Dienstag 23 März 2010 11:43:26 schrieb Richter, Christian:
> Hi,
>
> I try configure an AnalogIO-Slave like in the User-example, but have
> problems with the Input-configuration. When running application error
> message "PDO entry 0x6000:02 does not byte-align in config 0:7. PDO entry
> registration failed!" occurs.
>
> The mapping looks like this:
>
> const static ec_pdo_entry_reg_t domain1_regs[] = {
> {AnaIO, Alex_1, 0x7010, 1, &off_ana_out1},
> {AnaIO, Alex_1, 0x7010, 2, &off_ana_out2},
> {AnaIO, Alex_1, 0x6000, 1, &off_ana_in1},
> {AnaIO, Alex_1, 0x6000, 2, &off_ana_in2},
> {AnaIO, Alex_1, 0x6000, 3, &off_ana_in3},
> {AnaIO, Alex_1, 0x6000, 4, &off_ana_in4},
> {AnaIO, Alex_1, 0x6000, 5, &off_ana_in5},
> {AnaIO, Alex_1, 0x6000, 7, &off_ana_in7},
> {AnaIO, Alex_1, 0x0000, 0, &off_ana_in0},
> {AnaIO, Alex_1, 0x6000, 11, &off_ana_in11},
> {AnaIO, Alex_1, 0x6000, 12, &off_ana_in12},
> {AnaIO, Alex_1, 0x6000, 15, &off_ana_in15},
> {AnaIO, Alex_1, 0x6000, 16, &off_ana_in16},
> {AnaIO, Alex_1, 0x6000, 19, &off_ana_in19},
> {AnaIO, Alex_1, 0x6000, 13, &off_ana_in13},
> {AnaIO, Alex_1, 0x6000, 14, &off_ana_in14},
> {}
> };
>
> static ec_pdo_entry_info_t alex_1_channels[] = {
> {0x7010, 1, 16},
> {0x7010, 2, 16}
> };
> static ec_pdo_entry_info_t alex_in_channels[] = {
> {0x6000, 1, 1},
> {0x6000, 2, 1},
> {0x6000, 3, 1},
> {0x6000, 4, 1},
> {0x6000, 5, 2},
> {0x6000, 7, 2},
> {0x0000, 0, 8},
> {0x6000, 11, 32},
> {0x6000, 12, 32},
> {0x6000, 15, 16},
> {0x6000, 16, 16},
> {0x6000, 19, 16},
> {0x6000, 13, 16},
> {0x6000, 14, 16}
> };
>
> static ec_pdo_info_t alex_1_pdos[] = {
> {0x1601, 2, alex_1_channels}
> };
>
> static ec_pdo_info_t alex_in_pdos[] = {
> {0x1a00, 14, alex_in_channels}
> };
>
> static ec_sync_info_t alex_1_syncs[] = {
> {2, EC_DIR_OUTPUT, 1, alex_1_pdos},
> {3, EC_DIR_INPUT, 1, alex_in_pdos},
> {0xff}
> };
>
> hope some one can help me to solve the "byte-align"-problem
>
> best regards
> Christian Richter
> Christian Richter
> Forschung/Entwicklung
那么如何利用ecrt_slave_config_reg_pdo_entry来一个一个注册呢?
可以看到这个函数是如何使用的。
然后给出我程序中的一部分:
/*Register a PDO entry for process data exchange in a domain*/
if(ecrt_slave_config)reg_pdo_entry(sc_xmc4800, 0x7000,1,domain1,&off_leds_out0) < 0){
fprintf(stderr, "PDO entry registration failed!\n";
return -1;
}
if(ecrt_slave_config)reg_pdo_entry(sc_xmc4800, 0x6000,1,domain1,&off_buttons_in0) < 0){
fprintf(stderr, "PDO entry registration failed!\n";
return -1;
}
这样多次调用多次注册就好了。大概明白了吗?