Proteus Simulation: Rolling Display of 8-Digit LED

Name: 8 Digit Rolling Display of Number String

Software: Proteus

Keil 4

Language: C Language

Usage Instructions: In this example, the simulation of 8 digit displays rolling to the left shows a number string consisting of 3 characters.

Example Image:

Proteus Simulation: Rolling Display of 8-Digit LED

Proteus Simulation – 8 Digit Rolling Display of Number String

Program:

  1. /*

  2. Name: 8 Digit Rolling Display of Number String

  3. Description: The digit display rolls to the left showing a number string made of 3 characters

  4. */

  5. #include

  6. #include

  7. #define uchar unsigned char

  8. #define uint unsigned int

  9. // Segment Code Table

  10. uchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};

  11. // The following array is considered as a circular queue, displaying 8 numbers starting from a certain number (10 indicates black screen)

  12. uchar Num[]={10,10,10,10,10,10,10,10,2,9,8};

  13. // Delay

  14. void DelayMS(uint x)

  15. {

  16. uchar t;

  17. while(x–) for(t=0;t<120;t++);

  18. }

  19. // Main Program

  20. void main()

  21. {

  22. uchar i,j,k=0,m=0x80;

  23. while(1)

  24. { // Refresh several times to maintain a stable display for a period

  25. for(i=0;i<15;i++)

  26. {

  27. for(j=0;j<8;j++)

  28. {

  29. // Send segment code, using circular access starting from the k-th

  30. P0=0xff;

  31. P0=DSY_CODE[Num[(k+j)%11]];

  32. m=_crol_(m,1);

  33. P2=m; // Send digit code

  34. DelayMS(2);

  35. }

  36. }

  37. k=(k+1)%11; // Increment k for circular queue head, Num index range 0~10, hence modulo 11

  38. }

  39. }

    /***************Elegant Divider***********************/

Program:

The Proteus software is an EDA tool developed by Labcenter Electronics in the UK, representing a new generation of electronic design platforms that integrate teaching, experimentation, and design; it includes functions for electrical and electronic simulation design, electronic technology simulation design, and microcontroller application design verification. It runs on Windows operating systems and can simulate and analyze various analog devices and integrated circuits (SPICE).

The Proteus Tutorial Resource Network (proteuseda.com) was founded in 2018, and the site owner, as an electronic engineer, is dedicated to promoting the development of electronic design automation in China, collecting and sharing various excellent Proteus simulation tutorials and materials. I hope to contribute a little to China’s intelligent manufacturing.

/*******************************************/

Click the bottom right “Read the Original” for more simulation examples

Leave a Comment