'**************************************************************** '* Name : OSD-Modul_V01c.bas * '* Author : Tomtom DL1MFK * '* Version : 1.0c 10'/2007 * '* Notes : Anpassung an verschieden Schriftgrößen eingebaut * '* : Modulfunktionen angefangen * '**************************************************************** '**************************************************************** ' Register-Deklarationen * '**************************************************************** $regfile = "M8def.dat" $crystal = 8867238 $baud = 19200 '**************************************************************** ' EEPromwerte beim Brennen speichern * '**************************************************************** Eepromdaten: $eeprom ' Byte 2 Byte1 !!!====!!! wenn Word gelesen werden dann in umgekehrter Reihenfolge !!!! Data 255 ' Erstes Byte nicht benutzen !!!! Data &B00001001 , &B10100001 ' COM 2 Vertikal 1mal so groß in 1. und 2. Zeile V Verschiebung 00_1001 Data &B00011010 , &B10110001 ' COM 3 Horizontal 1mal so groß in 1. und 2. Zeile H Verschiebung 01_1111 Data &B00000011 , &B11011100 ' COM 5 ... PAL ... Data &B00000010 , &B11100000 ' COM 6 Data &B00001010 , &B11110011 ' COM 10 LNC Farbe Einstellen Zeile1 Cyan Data &B00000001 , &B11110101 ' COM 12 $data '**************************************************************** ' Deklarationen * '**************************************************************** Dim Bytes As Word Dim Byte1 As Byte Dim Byte2 As Byte Dim Value As Bit ' für Datenausgabe Dim I As Byte Dim Stelle0 As Word Dim Stelle1 As Word Dim Stelle2 As Word Dim Stelle3 As Word Dim Lin As Byte ' Zeilennummer Dim Col As Byte ' Spaltennummer Dim Pegel As Word Dim Pegel_l As Long ' um Single-Arithmetik zu vermeiden Dim Ergebnis As Word Dim L_balken As Byte ' Länge des Balkens Dim N As Word ' Zählvariable Config Pinb.0 = Output Config Pind.7 = Output Config Pind.6 = Output Config Pind.5 = Input Lc_dat Alias Portb.0 ' Daten (LC pin 11) Lc_clk Alias Portd.7 ' Clock (LC pin 10) Lc_ce Alias Portd.6 ' Enable (LC pin 9) Lc_sync Alias Pind.5 ' Sync detect '**************************************************************** ' Command Strukturen * '**************************************************************** Dim Comx(7) As Word Dim Comd As Word Com2 Alias Comx(1) Com3 Alias Comx(2) Com5 Alias Comx(3) Com6 Alias Comx(4) Com10 Alias Comx(5) Com12 Alias Comx(6) 'Com12 Alias Comx(7) '**************************************************************** ' Konstanten * '**************************************************************** Const Command0 = &B1000_0000_0000_0000 '**************************************************************** ' Initialisierung * '**************************************************************** Waitms 500 Gosub Eeprom_lesen Gosub Osd_init Gosub Disp_an Gosub Rufz_anzeigen '**************************************************************** ' Hauptschleife * '**************************************************************** Do If Lc_sync = 0 Then Bytes = &B1101_1101_0000_0011 ' COM 5 ... umschalten auf Internen Sync für Farbiges Bild ... Gosub Leitung Gosub Zaehlen Else ' Gosub Osd_init Bytes = &B1101_1100_0000_0011 ' COM 5 ... umschalten auf Einblendung Gosub Leitung End If 'Gosub Erste_zeile_gross 'Gosub Alle_zeichen 'Gosub Zaehlen Loop ' End '**************************************************************** ' OSD Initialisierung * '**************************************************************** Osd_init: Gosub Disp_aus Bytes = &B1100_0001_0000_0000 ' Com 4 Reset Gosub Leitung Bytes = &B1100_0100_0000_0000 ' Com 4 Ram löschen !!! Gosub Leitung Waitms 1 For I = 1 To 6 Bytes = Comx(i) Gosub Leitung Next Return '**************************************************************** ' EEProm auslesen * '**************************************************************** Eeprom_lesen: For I = 0 To 5 N = 2 * I N = N + 1 Readeeprom Comd , N Comx(i + 1) = Comd Next Return '**************************************************************** ' EEProm schreiben * '**************************************************************** Eeprom_schreiben: For I = 0 To 5 Comd = Comx(i + 1) N = I * 2 N = N + 1 Writeeeprom Comd , N Next Return '**************************************************************** ' Rufzeichen einblenden * '**************************************************************** Rufz_anzeigen: ' Rufzeichen anzeigen: Lin = 1 : Col = 5 '19 Gosub Position Gosub Leitung Byte1 = &B1001_0000 Byte2 = "D" Gosub Leitung2 Byte2 = "L" Gosub Leitung2 Byte2 = "1" Gosub Leitung2 Byte2 = "M" Gosub Leitung2 Byte2 = "F" Gosub Leitung2 Byte2 = "K" Gosub Leitung2 Return '**************************************************************** ' Bis 100 zählen und Anzeigen * '**************************************************************** Zaehlen: For I = 0 To 10 Lin = 1 : Col = 1 Gosub Position ' Position aus Zeile und Spalte Gosub Leitung Byte1 = &B1001_0000 Stelle0 = I \ 100 Byte2 = 48 + Stelle0 'Print Chr(byte2); Gosub Leitung2 Stelle0 = I Mod 100 Stelle1 = Stelle0 \ 10 Byte2 = 48 + Stelle1 'Print Chr(byte2); Gosub Leitung2 Stelle2 = Stelle0 Mod 10 Byte2 = 48 + Stelle2 'Print Chr(byte2) Gosub Leitung2 Waitms 50 Next Return '**************************************************************** '' AlleZeichen Schleife * '**************************************************************** Alle_zeichen: Bytes = &B1000_0000_0000_0000 ' Pos: Line 0, Col 0 Gosub Leitung Byte1 = &B1001_0000 For I = 0 To 255 Byte2 = I Gosub Leitung2 Next Return '**************************************************************** ' Daten auf die 3 Leitungen * '**************************************************************** Leitung: ' Byte1 und Byte2 aus Bytes Byte1 = High(bytes) Byte2 = Low(bytes) Lc_ce = 0 Waitus 3 Shiftout Lc_dat , Lc_clk , Byte1 , 2 ' Mode 2 (LSB out first, clock falling edge) Waitus 3 ' Shiftout Lc_dat , Lc_clk , Byte2 , 2 Waitus 3 Lc_ce = 1 Return Leitung2: ' Byte1 und Byte2 einzeln gesetzt Lc_ce = 0 Waitus 3 Shiftout Lc_dat , Lc_clk , Byte1 , 2 Waitus 3 Shiftout Lc_dat , Lc_clk , Byte2 , 2 Waitus 3 Lc_ce = 1 Return '***************************************************************** ' Position aus Zeile und Spalte * '***************************************************************** Position: Lin = Lin - 1 ' 1. Zeile = 0 Col = Col - 1 ' 1. Spalte = 0 Bytes = Makeint(col , Lin) Bytes = Bytes Or Command0 Return '**************************************************************** ' Display An/Ausschalten * '**************************************************************** Disp_an: Bytes = &B1100_0000_0010_0001 ' Com4 Display angeschaltet mit Rand um Zeichen Gosub Leitung Return Disp_aus: Bytes = &B1100_0000_0010_0000 ' Com4 Display aus mit Hg Gosub Leitung Return