پین های D.0 تا D.3 به LED متصل می شوند. میتوانید برنامه را برای پورت های بیشتر هم ادامه بدهید.

 

  $regfile = "m16def.dat"

  $crystal = 1000000

  Config Portd = Output

 

  Dim Portd.0 As Byte

  Dim Portd.1 As Byte

  Dim Portd.2 As Byte

  Dim Portd.3 As Byte

  Dim Portd.4 As Byte

  Dim Portd.5 As Byte

  Dim Portd.6 As Byte

  Dim Portd.7 As Byte

 

Do

 

Ddrd.0 = 1

Ddrd.1 = 1

Ddrd.2 = 1

Ddrd.3 = 1

Ddrd.4 = 1

Ddrd.5 = 1

Ddrd.6 = 1

Ddrd.7 = 1

'مقداردهی اولیه

Portd.0 = 0

Portd.1 = 0

Portd.2 = 0

Portd.3 = 0

Portd.4 = 0

Portd.5 = 0

Portd.6 = 0

Portd.7 = 0

 

 

Waitms 1

Set Portd.0

Waitms 1

Reset Portd.0

Waitms 1

Set Portd.1

Waitms 1

Reset Portd.1

Waitms 1

Set Portd.2

Waitms 1

Reset Portd.2

Waitms 1

Set Portd.3

Waitms 1

Reset Portd.3

 

Loop

End