'***************************************************** '* Description : Olimex AVR-MT Demo '* Compiler : BASCOM-AVR 1.11.8.7.001 '***************************************************** $regfile = "2313def.dat" $crystal = 10000000 'Setup LED/Relay PD.3 for output Ddrd = &B11110000 'Setup LCD Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3 , E = Portd.6 , Rs = Portd.4 Dim A As Byte 'Dimensions of LCD Config Lcd = 16 * 2 'Setup buzzer Config Portb.4 = Output Speaker Alias Portb.4 'Setup Buttons Variable Dim Button As Bit '* Main AVR-MT Demo Program Do 'Write to LCD 'Clear LCD Cls 'Top Line Lcd "popsci.com" Waitms 10 'Select Lower Line Lowerline Lcd "AVR-MT Demo" Wait 1 'Shift Text Right For A = 1 To 10 Shiftlcd Right Delay Next Waitms 20 'Shift Text Left For A = 1 To 10 Shiftlcd Left Delay Next Waitms 20 'Place Cursor Line, Position Locate 2 , 1 Lcd "Olimex" Waitms 10 'Shift Cursor Right Shiftcursor Right Lcd "/SparkFun" Waitms 10 'Select Top Line Home Upper Lcd "HOW2.0 Blog" Wait 1 'Hide Cursor Cursor Off Noblink Waitms 50 'Show Cursor Cursor On Blink Waitms 100 'Turn OFF LCD Display Off Waitms 100 'Turn ON LCD Display On Waitms 100 Cursor Off Noblink '* End LCD Demo 'Light LED Cls Lcd "LED" Set Portd.3 Wait 1 Reset Portd.3 'Play buzzer Cls Lcd "Buzzer" 'Buzzer Data 'Sound Speaker , Pulses , Periods Sound Speaker , 65 , 1274 Sound Speaker , 82 , 1011 Sound Speaker , 87 , 954 Sound Speaker , 196 , 850 Sound Speaker , 65 , 1274 Sound Speaker , 82 , 1011 Sound Speaker , 87 , 954 Sound Speaker , 196 , 850 Sound Speaker , 65 , 1274 Sound Speaker , 82 , 1011 Sound Speaker , 87 , 954 Sound Speaker , 196 , 850 'Light LED Cls Lcd "LED" Set Portd.3 Wait 1 Reset Portd.3 'Determine Each Button State '6 Buttons: B1-B6; 3 Ports: PB5-PB7 Cls Lcd "Press Button 1" Lowerline : Lcd "to Exit" Do Ddrb = &B10001111 Set Portb.7 Reset Portb.5 Button = Pinb.5 If Button = 1 Then Cls Lcd "Button 3" End If Button = Pinb.6 If Button = 1 Then Cls Lcd "Button 5" End If Ddrb = &B01001111 Set Portb.6 Reset Portb.7 Button = Pinb.5 If Button = 1 Then Cls Lcd "Button 4" End If Button = Pinb.7 If Button = 1 Then Cls Lcd "Button 2" End If Ddrb = &B00101111 Set Portb.5 Reset Portb.6 Button = Pinb.6 If Button = 1 Then Cls Lcd "Button 1" Exit Do End If Button = Pinb.7 If Button = 1 Then Cls Lcd "Button 6" End If Loop Loop