HomeTOOLSEXAMPLESEXPLORE EMBEDDEDE CSERVICESECU SAMPLESRegistration
Embedded C programming Tutorial , Keil C ide , microsoftware.gr
Keil CRC and CAN BUS codes.
1. Shift led left
2.It's time for DAVE! <7/6/13>
3.Capture/Compare unit 6
4.ASC0-GPT1-MACROS
5.ASC0-FIFO-PEC
6.Analog converter
7.Memory manipulation routines
8. Recursion
9.Understanding interrupt priorities using CAPCOM2 module
10. POINTERS TO FUNCTION <4/7/13>,<4/28/13>
11.Memory models, memory types
12. The heap , part 1
13. The heap , part 2
14. The heap , part 3
15. Structure example
16. Nested structures, Array of structures.
17. Passing array of structures to function using pointers.<1/5/13>
18. Self Referential Structures
19. BITFIELDS
20. Linked list example
21. Circular linked list
22. Union example
23. Enumeration example
24. Watchdog timer example
25. Void pointer example <7/4/13>
26. The sieve of Eratosthenes
27. The stack
28. Union and bitfields as flags example. <6/23/13>
29. Look up table example. <8/11/13>
30. Seven segment display multiplexing -four digits with dot- example
31. LCD character display example - JHD162A
32. Hash table introduction example <8/27/14>
33. Array of Linked Lists example
34. Array of Linked lists-more functions included.
35. Hash table construction,searching and printing.
36. Fininte state machines- a first approach.
37. Finite state machines- two events example.
38. SPI port and an AT25128 serial eeprom hardware.
39. CRC CHECK
40. Definite Integral Calculator for Scientists, Engineers...
41 .Hamming distance of a CRC polynomial
42. Linux play starting.
43. Galois GF(2^4) Finite Field
44. Construct your own time triggered real time operating system.
45. CANBUS C CODE EXAMPLE.
30. Seven segment display multiplexing -four digits with dot- example

This article is a four seven segment digit with dot multiplexing example.

Please read them: seven segment display     ,   seven segment display


The program receives a float number throught hyperterminal, separates the integer and fractional part using modf() mathematical function included
at <math.h> ,finds the four digits that will be presented at the four displays,
finds the corresponding integers that will turn ON the right segments of the displays and finally finds the right place of the "dot" segment.
Unwanted zeros in front of the number are not displayed.
For example 3 is displayed as 3.000 and not as 0003.  A 3.45 is displayed as 3.450

To turn ON  the right segments we use a lookup table:
unsigned int  table[11]={0X7E,0X30,0X6D,0X79,0X33,0X5B,0X5F,0X70,0X7F,0X7B};

To multiplex the four digits we use a timer T2 interrupt at 0.5 sec. It is a slow multiplexing rate , used for educational purpose only.In practice you have to decrease it using DAVE. The multiplexing code is in GPT1.C file.

The four displays are common cathode displays conected at P1H (multiplexed at
P1H3,P1H2,P1H1,P1H0 pins of the parallel port) and the corresponding data are at
P1L (P1L6,P1L5,P1L4,P1L3,P1L2,P1L1,P1L0 pins , "dot" at P1L7 pin of the port).



The C code                                           
The result

So, run the code at simulator and watch the displays "dancing".


Debuger C code                                      The result

* The i counter included at interrupt C code is not needed.


 

Home|TOOLS|EXAMPLES|EXPLORE EMBEDDEDE C|SERVICES|ECU SAMPLES|Registration