3.Software
Diesen Teil widme ich der Software und beschreibe dort den Aufbau des
Programmes in Abschnitten. Von der Zuordnung der Portpins bis zur Inter-
ruptroutine für den UART. Der MCU(AT90S8515) fungiert als Displaycontroller,
der mit der Aussenwelt offen kommuniziert, Zeichen oder Worte aufnimmt per
UART und an das Display weiterleitet.
Das Programm befindet sich noch im Aufbau und kann erst mal grundlegend die
grossen Buchstaben und die Ziffern 0-9 darstellen. Weiterentwicklungen wären
da noch einen Befehlssatz zu definieren, um z.B.: die Helligkeit zu steuern
oder die Art der Darstellung im Display(Laufschrift oder scrolling) zu be-
stimmen.
Unten wird nun die Software vollständig beschrieben, bitte beachten Sie da-
zu die ausklappbaren Erläuterungen zum Programmcode.

Description
$regfile = "8515def.dat"                                    
$crystal = 8000000
$baud = 19200
$hwstack = 64
$swstack = 64
$framesize = 40
Declare Sub Vfdprint(byval Vfdstr As String)

Description
Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Down , Prescale = 1
Pwm1b = 255

Description
Enable Interrupts
Enable Urxc

On Urxc Receiveint

Description
Dim Digit As Byte , D1 As Byte , S As Byte , Ch As Byte , Chstr As String * 13 , Command(2) As Byte
Dim Refresh As Integer , Comset As Bit

Description
Alias Porta.: B Alias Porta.: F Alias Portb.: K Alias Portb.: J Alias Portb.: H Alias Portb.: M Alias Portb.5
Alias Portb.: N Alias Portb.: P Alias Portd.: R Alias Portd.: C Alias Portd.: E Alias Portd.: D Alias Portd.7

Grid11 Alias Porta.: Grid10 Alias Porta.: Grid9 Alias Porta.: Grid8 Alias Porta.: Grid7 Alias Portc.7
Grid6 Alias Portc.: Grid5 Alias Portc.: Grid4 Alias Portc.: Grid3 Alias Portc.: Grid2 Alias Portc.2
Grid1 Alias Portc.1

Description
Config Porta = Output
Config Portb = Output
Config Portc = Output
Config Portd = Output

 Porta = Porta Or 255
 Portb = Portb Or 254
 Portd = Portd Or 252
Description

Reset Portd.3
Reset Portb.7
Reset Portb.2
Reset Portb.4
Reset Portb.5
Reset Portb.6
Portb.= 0
Portd.= 0

Command(1) = 98
Command(2) = 99
Comset = 0

Description
Do
 Waitms 1
 Vfdprint Chstr

'Vfdprint "RAINER"
Loop
Description

Sub Vfdprint(byval Vfdstr As String)

Dim Tmpstr As String * 1 , Ascsign As Byte


Description
For Digit = 1 To 10

Tmpstr = Mid(vfdstr , Digit , 1)
Ascsign = Asc(tmpstr)
Description

If Ascsign <> 46 And Ascsign < 92 And Comset = 0 And Ascsign <> 0 Then
Select Case Digit

Case 1 : Reset Grid1
Case 2 : Reset Grid2
Case 3 : Reset Grid3
Case 4 : Reset Grid4
Case 5 : Reset Grid5
Case 6 : Reset Grid6
Case 7 : Reset Grid7
Case 8 : Reset Grid8
Case 9 : Reset Grid9
Case 10 : Reset Grid10
End Select
End If
Description
Select Case Ascsign

Case 65
= 0 : B = 0 : C = 0 : E = 0 : F = 0 : G = 0 : M = 0
Case 66
= 0 : D = 0 : J = 0 : P = 0 : M = 0 : B = 0 : C = 0
Case 67
= 0 : D = 0 : F = 0 : E = 0
Case 68
= 0 : B = 0 : C = 0 : D = 0 : J = 0 : P = 0
Case 69
= 0 : D = 0 : E = 0 : F = 0 : G = 0 : M = 0
Case 70
= 0 : F = 0 : E = 0 : M = 0 : G = 0
Case 71
= 0 : F = 0 : E = 0 : D = 0 : C = 0 : M = 0
Case 72
= 0 : B = 0 : C = 0 : E = 0 : G = 0 : M = 0
Case 73
= 0 : P = 0 : A = 0 : D = 0
Case 74
= 0 : C = 0 : D = 0
Case 75
= 0 : E = 0 : K = 0 : N = 0 : G = 0
Case 76
= 0 : D = 0 : E = 0
Case 77
= 0 : B = 0 : C = 0 : E = 0 : H = 0 : K = 0
Case 78
= 0 : B = 0 : C = 0 : E = 0 : H = 0 : N = 0
Case 79
= 0 : E = 0 : B = 0 : C = 0 : A = 0 : D = 0
Case 80
= 0 : F = 0 : G = 0 : M = 0 : B = 0 : A = 0
Case 81
= 0 : E = 0 : B = 0 : C = 0 : D = 0 : A = 0 : N = 0
Case 82
= 0 : E = 0 : A = 0 : B = 0 : M = 0 : G = 0 : N = 0
Case 83
= 0 : F = 0 : G = 0 : M = 0 : C = 0 : D = 0
Case 84
= 0 : J = 0 : P = 0
Case 85
= 0 : E = 0 : D = 0 : C = 0 : B = 0
Case 86
= 0 : E = 0 : R = 0 : K = 0
Case 87
= 0 : E = 0 : R = 0 : N = 0 : C = 0 : B = 0
Case 88
= 0 : N = 0 : H = 0 : K = 0
Case 89
= 0 : K = 0 : P = 0
Case 90
= 0 : K = 0 : R = 0 : D = 0

Case 48
= 0 : E = 0 : B = 0 : C = 0 : D = 0 : A = 0 : H = 0 : N = 0
Case 49
= 0 : B = 0 : C = 0
Case 50
= 0 : B = 0 : M = 0 : G = 0 : E = 0 : D = 0
Case 51
= 0 : B = 0 : C = 0 : D = 0 : M = 0
Case 52
= 0 : G = 0 : M = 0 : J = 0 : P = 0
Case 53
= 0 : H = 0 : M = 0 : C = 0 : D = 0
Case 54
= 0 : F = 0 : G = 0 : M = 0 : C = 0 : D = 0 : E = 0
Case 55
= 0 : K = 0 : R = 0
Case 56
= 0 : B = 0 : C = 0 : D = 0 : E = 0 : F = 0 : G = 0 : M = 0
Case 57
= 0 : B = 0 : C = 0 : D = 0 : F = 0 : G = 0 : M = 0

Case 42
= 0 : P = 0 : G = 0 : M = 0 : H = 0 : N = 0 : R = 0 : K = 0
Case 44
= 0
Case 47
= 0 : K = 0
Case 92
= 0 : N = 0
Case 43
= 0 : P = 0 : G = 0 : M = 0
Case 45
= 0 : M = 0
Case 61
= 0 : A = 0
Case 32
= 1 : B = 1 : C = 1 : D = 1 : E = 1 : F = 1 : H = 1 : J = 1 : K = 1 : M = 1 : N = 1 : P = 1 : R = 1

End Select

Description
Select Case Command(1)
Case 98
If Command(2) = 97 Then Waitus 1
If Command(2) = 98 Then Waitus 10
If Command(2) = 99 Then Waitus 50
If Command(2) = 100 Then Waitus 100
If Command(2) = 101 Then Waitus 200
If Command(2) = 102 Then Waitus 500
If Command(2) = 103 Then Waitms 1
If Command(2) = 104 Then Waitms 2

Case 100
If Command(2) = 97 Then Chstr = ""
End Select
Description
Porta = 255
Portb = 255
Portd = 252
Portc = 255

Next Digit



End Sub
Description
Receiveint:
Ch = Udr
Digit = 1
If Ch > 96 And Comset = 0 Then
Command(1) = Ch
Comset = 1
Elseif Comset = 1 Then
Command(2) = Ch
Comset = 0
Elseif Ch < 92 And Comset = 0 Then
Chstr = Chstr + Chr(ch)
End If

If Len(chstr) > 12 Then
Chstr = ""
End If

Return

End
zurück