你好Gianluca,
1)第一个问题:
是一些调用的回调,回调应该在你的配置& icu_config_icucfg中
你应该删除你的主要
2)第二个问题:
Arduino-Style中的PulseIn是一种阻塞功能
读取引脚上的脉冲(高电平或低电平)。例如,如果是,等待引脚走,开始计时,然后等待引脚停止计时。以微秒为单位返回脉冲的长度。如果在指定的超时内没有脉冲开始,则返回并返回0。
你的日志太快了:
您应该在记录之前等待一些时间,或者在中断级别记录您的脉冲
明天,我将带上我的HC-SR04并尝试插上SPC560D Discovery Board
最好的祝福
二万
以上来自于谷歌翻译
以下为原文
Hello Gianluca ,
1) First Problem :
- icuwidthcb(ICUDriver *icup) {
- palSetPad(PORT_A, Led_D12);
- last_width = icuGetWidth(icup);
- icuperiodcb(ICUDriver *icup) {
- palClearPad(PORT_A, Led_D12);
- last_period = icuGetPeriod(icup);
are some callbacks called by and the callbacks should be in your configuration &icu_config_icucfg
- icuStart(&ICUD4, &icu_config_icucfg);
you should remove in your main
2) 2nd Problem :
- chprintf((BaseSequentialStream *)&SD1,
- ''Input Capture 3 Value is %u, %urn''
- , last_width, last_period);
PulseIn in Arduino-Style is a blocking function
Reads a pulse (either HIGH or LOW) on a pin. For example, if is , waits for the pin to go , starts timing, then waits for the pin to go and stops timing. Returns the length of the pulse in microseconds.Gives up and returns 0 if no pulse starts within a specified time out.
Your log is too fast :
you should wait some times before logging or log your pulse at Interruption level
Tomorrow , i will bring my HC-SR04 and try to plug on SPC560D Discovery Board
Best regards
Erwan
你好Gianluca,
1)第一个问题:
是一些调用的回调,回调应该在你的配置& icu_config_icucfg中
你应该删除你的主要
2)第二个问题:
Arduino-Style中的PulseIn是一种阻塞功能
读取引脚上的脉冲(高电平或低电平)。例如,如果是,等待引脚走,开始计时,然后等待引脚停止计时。以微秒为单位返回脉冲的长度。如果在指定的超时内没有脉冲开始,则返回并返回0。
你的日志太快了:
您应该在记录之前等待一些时间,或者在中断级别记录您的脉冲
明天,我将带上我的HC-SR04并尝试插上SPC560D Discovery Board
最好的祝福
二万
以上来自于谷歌翻译
以下为原文
Hello Gianluca ,
1) First Problem :
- icuwidthcb(ICUDriver *icup) {
- palSetPad(PORT_A, Led_D12);
- last_width = icuGetWidth(icup);
- icuperiodcb(ICUDriver *icup) {
- palClearPad(PORT_A, Led_D12);
- last_period = icuGetPeriod(icup);
are some callbacks called by and the callbacks should be in your configuration &icu_config_icucfg
- icuStart(&ICUD4, &icu_config_icucfg);
you should remove in your main
2) 2nd Problem :
- chprintf((BaseSequentialStream *)&SD1,
- ''Input Capture 3 Value is %u, %urn''
- , last_width, last_period);
PulseIn in Arduino-Style is a blocking function
Reads a pulse (either HIGH or LOW) on a pin. For example, if is , waits for the pin to go , starts timing, then waits for the pin to go and stops timing. Returns the length of the pulse in microseconds.Gives up and returns 0 if no pulse starts within a specified time out.
Your log is too fast :
you should wait some times before logging or log your pulse at Interruption level
Tomorrow , i will bring my HC-SR04 and try to plug on SPC560D Discovery Board
Best regards
Erwan
举报