Mit dem folgenden Code
dreht sich n nettes Herzchen beim Nachbarn
an der Hauswand 
Code:
$regfile = "m8def.dat"
$crystal = 16000000
$hwstack = 30 ' default use 32 for the hardware stack
$swstack = 50 ' default use 10 for the SW stack
$framesize = 50
$baud = 250000
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 2 , Databits = 8
Dim A_byte(18) As Byte
Dim Countbyte1 As Byte
Dim Flag(9) As Byte
Led Alias Portd.7
Config Led = Output
Uart_tx Alias Portd.1
Config Uart_tx = Output
485_rw Alias Portd.4
Config 485_rw = Output
485_rw = 1
A_byte(1) = 199
A_byte(2) = 128
A_byte(3) = 61
A_byte(4) = 1
A_byte(5) = 1
A_byte(6) = 1
A_byte(7) = 1
A_byte(8) = 1
A_byte(9) = 0
A_byte(10) = 0
A_byte(11) = 0
A_byte(12) = 250
A_byte(13) = 0
A_byte(14) = 0
A_byte(15) = 0
A_byte(16) = 0
A_byte(3) = A_byte(3) * 2
Do
If A_byte(3) > 252 Then A_byte(3) = 0
Ucsrb = Ucsrb And &B11100111
Reset Uart_tx
Waitus 95
Set Uart_tx
Ucsrb = Ucsrb Or &B00011000
Waitus 44
For Countbyte1 = 1 To 16
Udr = A_byte(countbyte1)
Do
Loop Until Ucsra.txc = 1
Reset Ucsra.txc
Waitus 44
Next
Waitms 100
Toggle Led
If Flag(8) = 0 Then ' rotation
A_byte(8) = A_byte(8) + 1
Else
A_byte(8) = 0
Flag(8) = 0
End If
If Flag(6) = 0 Then
A_byte(6) = A_byte(6) + 3
Else
A_byte(6) = A_byte(6) - 3
End If
If Flag(7) = 0 Then
A_byte(7) = A_byte(7) + 2
Else
A_byte(7) = A_byte(7) - 2
End If
For Countbyte1 = 6 To 12
If A_byte(countbyte1) > 127 Then Flag(countbyte1) = 1
If A_byte(countbyte1) < 5 Then Flag(countbyte1) = 0
Next
Loop
Lesezeichen