| |

VerySource

 Forgot password?
 Register
Search
View: 1558|Reply: 3

I use the following program, please master to teach it.

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-9 15:30:01
| Show all posts |Read mode
I have a value in my counter, I want to read it out, I don't know how to do it.
Such as,
  tcount = + (TH0 * 256 + TL0);
Then display
  unsigned int g1, g2, g3;
  dispbuf [0] = tcount / 1000;
  g1 = tcount% 1000;
  dispbuf [1] = g1 / 100;
  g2 = g1% 100;
  dispbuf [2] = g2 / 10;
  g3 = g2% 10;
  dispbuf [3] = g3;
  P0 = dispcode [dispbuf [dispbitcnt]];
  P2 = dispbitcode [dispbitcnt];
  dispbitcnt ++;
  if (dispbitcnt == 4)
  {
    dispbitcnt = 0;
  }
I tried a few times, but it turned out to be wrong. I want to show how to write the lowest two digits of TH0 and the highest two digits of TL0?
Reply

Use magic Report

0

Threads

6

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-2-13 15:19:10
| Show all posts
((TH0&0x3) << 2) | ((TL0&0xC0) >> 6)
Is this not possible?
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-17 23:00:01
| Show all posts
First use software to simulate it and see what went wrong.
I don't know how you display it, I don't understand how to loop.
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-4-19 10:00:01
| Show all posts
It must be connected to the hardware
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list