no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | atmel:spinner [2009/11/27 17:53] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== come in Spinner ====== | ||
+ | Often the AVR is scanning an RS232 stream waiting for some byte sequence before allowing real user input. | ||
+ | |||
+ | Code has been written for the AVR-SDK1 mega-8 development board. | ||
+ | |||
+ | <code vb> | ||
+ | ' Spinner.bas | ||
+ | ' | ||
+ | ' Read input from keyboard and wiggle a char on the LCD until +++ is seen. | ||
+ | |||
+ | $regfile = " | ||
+ | $crystal = 4000000 | ||
+ | $baud = 9600 | ||
+ | |||
+ | $hwstack = 100 | ||
+ | $swstack = 100 | ||
+ | $framesize = 100 | ||
+ | |||
+ | Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2 | ||
+ | Config Lcd = 16 * 1a ' | ||
+ | |||
+ | Dim B As Byte | ||
+ | Dim I As Byte | ||
+ | Dim C As Byte | ||
+ | |||
+ | Const Wiggle_len = 4 | ||
+ | Dim Wiggle As String * Wiggle_len | ||
+ | Dim Wigglec(wiggle_len) As Byte At Wiggle Overlay | ||
+ | Wiggle = " | ||
+ | |||
+ | Cursor Off | ||
+ | |||
+ | ' \ char on the LCD is a Japanese Yen symbol. | ||
+ | Deflcdchar 0 , 32 , 16 , 8 , 4 , 2 , 1 , 32 , 32 | ||
+ | Wigglec(1) = 0 | ||
+ | |||
+ | Cls | ||
+ | Lcd " | ||
+ | |||
+ | B = 0 | ||
+ | I = 1 | ||
+ | Do | ||
+ | C = Inkey() | ||
+ | If C <> 0 Then | ||
+ | If C = " | ||
+ | Incr B | ||
+ | Else | ||
+ | B = 0 | ||
+ | End If | ||
+ | Lcd Chr(wigglec(i)) | ||
+ | Shiftcursor Left | ||
+ | Incr I | ||
+ | If I > Wiggle_len Then | ||
+ | I = 1 | ||
+ | End If | ||
+ | End If | ||
+ | Loop Until B = 3 | ||
+ | |||
+ | Cls | ||
+ | Lcd " | ||
+ | |||
+ | End | ||
+ | </ | ||
+ | {{tag> |