Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20563

BASCOM-AVR Old versions : Attiny2313 : NEWTOPIC

$
0
0
Required help for programing I am using attiny 2313 i am using 2 switch for controlling port b's led i wan't to make program as when Switch = 1 And Switch2 = 0 Then set port b1 and reset portb1 after 1 minute Switch = 1 And Switch2 = 1 Then set port b2 and reset portb2 after 1 minute Switch = 0 And Switch2 = 1 Then set port b3 and reset portb3 after 1 minute Switch = 0 And Switch2 = 0 Then set port b4 and reset portb4 after 1 minute Please help me to writing this program $regfile = "attiny2313.dat" $crystal = 1000000 $hwstack = 32 $swstack = 32 $framesize = 32 Set Mcucsr.7 ' Set Mcucsr.7 Ddrb = &B00011110 Ddrd = &B11110000 Portb = 0 Dim Firoz As Byte Dim Count As Byte Dim A As Byte Switch Alias Pind.1 Portd.1 = 0 Switch2 Alias Pind.2 Portd.2 = 0 Count = 0 Firoz = 0 A = 0 Do If Switch = 1 And Switch2 = 0 Then Count = 1 Reset Portb.2 Reset Portb.3 Reset Portb.4 Set Portb.1 End If If Switch = 1 And Switch2 = 1 Then Count = 2 Reset Portb.1 Reset Portb.3 Reset Portb.4 Set Portb.2 End If If Switch = 0 And Switch2 = 1 Then Count = 3 Reset Portb.2 Reset Portb.1 Reset Portb.4 Set Portb.3 End If If Switch = 0 And Switch2 = 0 Then Count = 4 Reset Portb.2 Reset Portb.3 Reset Portb.1 Set Portb.4 End If Loop End

Viewing all articles
Browse latest Browse all 20563

Trending Articles