> How To Use 4-digits multiplex LED display In AVR Microcontrollers?

<< My Speaking Language IS NOT ENGLISH, Excuseme For Grammar Error!>>

   The new generation microcontroller (AVR) have many function For Beginner Programmers.
One Of Them: LCD "A", Instead 100 Lines Or more.. In Assembly Mode!
But You know Lcd Module Are Expensive for use in Simple Projects such as Voltmeter Or Frequency Meter,
So I Deside To Learn You, How To Use Seven Segment LED Display Instead LCD Display.  
NOTE: I Work With BASIC Language & All Prog Written In "Bascom 1.11.7.4 FULL". U Can Download From www.mcselec.com

First Project Is Learning "How To Drive A Single-7Segment By ATMEGA8":

Schematic Diagram:

Schematic

Picture:

Picture

Program:

 

$regfile = "m8def.dat"
$crystal = 1000000
Config Portb = Output                                       'To 7sgmnt
Dim G As Byte
'**************Your Program Here: ************************************
Do
   Gosub Seven
   Incr G
   If G > 9 Then G = 0
   Wait 1
Loop
End
'*************DECODE 7 SEGMENT(S) ***********************************
Seven:
   Portb = 0                                                'Cls 7 Segment
   If G = 0 Then
      Set Portb.0 : Set Portb.1 : Set Portb.2 : Set Portb.3 : Set Portb.4 : Set Portb.5
   End If
   If G = 1 Then
      Set Portb.1 : Set Portb.2
   End If
   If G = 2 Then
      Set Portb.0 : Set Portb.1 : Set Portb.6 : Set Portb.4 : Set Portb.3
   End If
   If G = 3 Then
      Set Portb.0 : Set Portb.1 : Set Portb.6 : Set Portb.2 : Set Portb.3
   End If
   If G = 4 Then
      Set Portb.1 : Set Portb.2 : Set Portb.5 : Set Portb.6
   End If
   If G = 5 Then
      Set Portb.0 : Set Portb.5 : Set Portb.6 : Set Portb.2 : Set Portb.3
   End If
   If G = 6 Then
      Set Portb.0 : Set Portb.5 : Set Portb.6 : Set Portb.2 : Set Portb.3 : Set Portb.4
   End If
   If G = 7 Then
      Set Portb.0 : Set Portb.1 : Set Portb.2
   End If
   If G = 8 Then
      Set Portb.0 : Set Portb.1 : Set Portb.2 : Set Portb.3 : Set Portb.4 : Set Portb.5 : Set Portb.6
   End If
   If G = 9 Then
      Set Portb.0 : Set Portb.1 : Set Portb.5 : Set Portb.6 : Set Portb.2 : Set Portb.3
   End If
Return

'Connect Micro to 7sgmnt

'               b0
'               __
'            b5|  | b1
'               -- < b6
'            b4|  | b2
'               --.
'               b3

------------ END OF CODE ----------

http://electronic-projects.blogfa.com/