Created
December 3, 2012 16:52
-
-
Save rafalw/4196261 to your computer and use it in GitHub Desktop.
Sprzętowy UART w MCU's AVR - test.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Test UART - nadajnik (ATmega48P + ULN2803 + 3*LED) | |
$regfile = "m48pdef.dat" | |
$crystal = 4000000 | |
$baud = 9600 | |
$hwstack = 40 | |
$swstack = 16 | |
$framesize = 32 | |
$eeprom | |
Alfabet: | |
Data 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 | |
Data 77 , 78 , 79 , 80 , 81 , 82 , 83 , 84 , 85 , 86 , 87 , 88 | |
Data 89 , 90 , 27 | |
$data | |
Config Portc = &B0111111 | |
Portc = &B0000000 | |
Config Portd.2 = Input | |
Portd.2 = 1 | |
Dim Adres As Byte , Tmp As Byte | |
Dim Dioda As Byte | |
Dim Znak As Byte | |
Dim I As Byte | |
Adres = Loadlabel(alfabet) | |
Tmp = Adres | |
Do | |
Debounce Pind.2 , 0 , Wyslij , Sub | |
Loop | |
End | |
Wyslij: | |
For I = 1 To 27 | |
Readeeprom Znak , Tmp | |
Printbin Znak | |
If Dioda = 0 Then | |
Portc = 4 | |
Elseif Dioda = 2 Then | |
Portc = 1 | |
Else | |
Portc = 2 | |
End If | |
Incr Dioda | |
Dioda = Dioda Mod 3 | |
Waitms 500 | |
Incr Tmp | |
Next I | |
Tmp = Adres | |
Dioda = 0 | |
Portc = 0 | |
Return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Test UART - odbiornik (ATtiny2313 + wyświetlacz LCD) | |
$regfile = "attiny2313.dat" | |
$crystal = 4000000 | |
$baud = 9600 | |
$hwstack = 40 | |
$swstack = 16 | |
$framesize = 32 | |
Config Lcd = 16 * 1a | |
Dim Znak As Byte | |
Cls | |
Cursor Off | |
Lcd "Ready..." | |
Do | |
Znak = Inkey() | |
If Znak > 0 Then | |
If Znak <> 27 Then | |
Cls | |
Lcd "CHR: " + Znak + " " + Chr(znak) | |
Else | |
Cls | |
Lcd "End!" | |
Waitms 1000 | |
Cls | |
Lcd "Ready..." | |
End If | |
End If | |
Loop | |
End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment