2147 views|3 replies

3190

Posts

0

Resources
The OP
 

Problem with the second example in Chapter 10 of Zhou Hangci's book [Copy link]

 

I am studying ucosii and reading Zhou Hangci's "Programming Technology Based on Embedded Real-time Operating System (Second Edition)".

See Chapter 10, Example 2:

Using timer interrupts to control the sampling cycle - medium and high speed sampling example

Some of the code is as follows:



[

attach]464651

[/attach]





failed. I debugged it, as shown below:

According to the results printed by the serial port,

printf("222\r\n");

for(i=0;i<CONSTCNT;i++)

{

printf("333\r\n");

temp=(INT32U)(INT32U *)OSMboxPend(Mbox,0,&err); //Wait for data

printf("444\r\n");

Samp=(INT8U)(temp/10000);

}

It seems that the loop was executed once and got stuck on the second execution.

temp=(INT32U)(INT32U *)OSMboxPend(Mbox,0,&err);

But I tested it and the timer interrupt is fine, which means the data is sent.

Why didn't you wait for the data?

Please give me some advice, thank you!



4.jpg (113.45 KB, downloads: 0)

4.jpg

Latest reply

Why not post the code directly instead of a screenshot? It saves you a lot of trouble, but it troubles the people who want to help you. Do you have to ask them to type a code snippet again when you quote it? Forum support post code.   Details Published on 2020-3-17 22:52
Personal signature为江山踏坏了乌骓马,为社稷拉断了宝雕弓。
 

3190

Posts

0

Resources
2
 

Modified the interrupt program:

The effect is as follows:

It seems that the sampling time of ds18b20 is too long. The interrupt flag is cleared first, and then sampling is performed. Before the sampling is completed, the interrupt occurs again.

But there is a problem with this. The first press of the key works, but the second press does not work.

 
Personal signature为江山踏坏了乌骓马,为社稷拉断了宝雕弓。
 
 

7462

Posts

2

Resources
3
 

Why not post the code directly instead of a screenshot?

It saves you a lot of trouble, but it troubles the people who want to help you. Do you have to ask them to type a code snippet again when you quote it?

Forum support post code.

Comments

I was wrong, I will correct it next time. Don't use ds18b20, change it to tlc549  Details Published on 2020-3-18 08:04
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

3190

Posts

0

Resources
4
 
freebsder posted on 2020-3-17 22:52 Why don't you just post the code instead of a screenshot? You save yourself the trouble, but the people who want to help you have to type a code snippet themselves...

I was wrong, I will correct it next time. Don't use ds18b20, change it to tlc549

 
Personal signature为江山踏坏了乌骓马,为社稷拉断了宝雕弓。
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list