Aus RN-Wissen.de
Wechseln zu: Navigation, Suche
Laderegler Test Tueftler Seite

 
(Bascom Tabellen)
Zeile 1: Zeile 1:
 
== Bascom Tabellen ==
 
== Bascom Tabellen ==
 +
{{Baustelle|PicNick}}
  
 +
<pre>
 +
$regfile = "m32def.dat"
 +
$crystal = 8000000
 +
$baud = 9600
 +
$hwstack = 32
 +
$hwstack = 64
 +
$framesize = 32
 +
' ---------------------------------------------
 +
' Pixel Timer                ' 1 mS each pixel
 +
' ---------------------------------------------
 +
Config Timer0 = Timer , Prescale = 64
 +
Const Tim_preload = 131
 +
Dim Timerload As Byte
 +
  Timerload = Tim_preload
  
{{Baustelle|PicNick}}
+
  On Timer0 Isr_tim0
 +
  Timer0 = Timerload
 +
' ---------------------------------------------
 +
' Sync Interrupt
 +
' ---------------------------------------------
 +
Config Int0 = Falling
 +
  On Int0 Isr_int0
 +
 
 +
' ---------------------------------------------
 +
' Patterm dimension
 +
' ---------------------------------------------
 +
Const Pat_rows = 7
 +
Const Pat_cols = 5
 +
'----------------------------------------------
 +
Const Buf_chars = 16
 +
Const Col_chars = Pat_cols * Buf_chars
 +
' ---------------------------------------------
 +
'    0      Left          Top  255
 +
'    |.......|characters|...>.....
 +
' ---------------------------------------------
 +
Const Col_left = 12
 +
Const Col_top = 120
 +
' ---------------------------------------------
 +
'
 +
' ---------------------------------------------
 +
Dim Char_buffer As String * Buf_chars
 +
 
 +
Dim Charpntr As Word
 +
Dim Charcount As Byte
 +
Dim Pataddr As Word
 +
Dim Pattern As Word
 +
Dim Patcol As Byte
 +
 
 +
Dim Tim_flag As Byte
 +
Dim Show_flag As Byte
 +
Dim Work_flag As Byte
 +
 
 +
 
 +
Dim Charval As Byte
 +
Dim Charidx As Byte
 +
Dim Line_ctl As Byte
 +
Dim Charout As Byte
 +
    Enable Int0
 +
    Enable Timer0
 +
    Start Timer0
 +
    Enable Interrupts
 +
 
 +
    Pattern = Loadlabel(char_pattern)
 +
 
 +
' ---------------------------------------------
 +
'              Set Input
 +
' ---------------------------------------------
 +
Char_buffer = "0123456789ABCDEF"
 +
 
 +
' ---------------------------------------------
 +
'              Initial conditions
 +
' ---------------------------------------------
 +
  Patcol = 0
 +
  Line_ctl = 0
 +
  Work_flag = 0
 +
 
 +
  Do
 +
      If Tim_flag = 1 Then
 +
        Tim_flag = 0
 +
        If Show_flag = 1 Then
 +
            Print Bin(charout)
 +
        End If
 +
        Incr Line_ctl
 +
        If Line_ctl = Col_left Then
 +
            Work_flag = 1
 +
            Charpntr = Varptr(char_buffer)
 +
            Charcount = Buf_chars
 +
        End If
 +
        If Work_flag = 1 Then
 +
            If Patcol = 0 Then
 +
' read character & find pattern
 +
              Patcol = 1
 +
              Charval = Inp(charpntr)
 +
              Charidx = Lookdown(charval , Char_table , 16)
 +
              If Charidx < 255 Then
 +
                  Decr Charidx
 +
                  Pataddr = Charidx * Pat_cols
 +
                  Pataddr = Pataddr + Pattern
 +
                  Show_flag = 1
 +
              Else
 +
                  Show_flag = 0
 +
              End If
 +
            End If
 +
' prepare character pattern------------------------------------------
 +
            If Show_flag = 1 Then
 +
              Charout = Cpeek(pataddr)                    ' writout pattern
 +
              Incr Pataddr
 +
            Else
 +
              Charout = 0
 +
            End If
 +
' set next pattern column------------------------------------------
 +
            Incr Patcol
 +
            If Patcol > 5 Then
 +
              Patcol = 0
 +
              Print
 +
' step next character --------------------------------------------
 +
              Incr Charpntr
 +
              Decr Charcount
 +
              If Charcount = 0 Then
 +
' all done
 +
                  Work_flag = 0
 +
              End If
 +
            End If
 +
 
 +
      End If
 +
  End If
 +
Loop
 +
 
 +
End
 +
'------------------------------------------------
 +
Isr_tim0:
 +
  Timer0 = Timerload
 +
  Tim_flag = 1
 +
  Return
 +
'------------------------------------------------
 +
 
 +
Isr_int0:
 +
  Select Case Line_ctl
 +
  Case Is < Col_top:
 +
      Incr Timerload
 +
  Case Is > Col_top:
 +
      Decr Timerload
 +
  End Select
 +
  Line_ctl = 0
 +
  Return
 +
'------------------------------------------------
 +
 
 +
Char_table:
 +
'-------"0"-"1"-"2"-"3"-"4"-"5"-"6"-"7"-"8"-"9"
 +
  Data 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57
 +
'-------"A"--"B"--"C"--"D"--"E"--"F"
 +
  Data 65 , 66 , 67 , 68 , 69 , 70
 +
 
 +
 
 +
Char_pattern:
 +
' "0" -------------------------------------------
 +
Data &B01111100
 +
Data &B10000010
 +
Data &B10000010
 +
Data &B01111100
 +
Data &B00000000
 +
' "1" -------------------------------------------
 +
Data &B00000000
 +
Data &B00000100
 +
Data &B00000010
 +
Data &B11111110
 +
Data &B00000000
 +
' "2" -------------------------------------------
 +
Data &B11000100
 +
Data &B10100010
 +
Data &B10010010
 +
Data &B10001100
 +
Data &B00000000
 +
' "3" -------------------------------------------
 +
Data &B01000100
 +
Data &B10000010
 +
Data &B10010010
 +
Data &B01101100
 +
Data &B00000000
 +
' "4" -------------------------------------------
 +
Data &B00011100
 +
Data &B00010010
 +
Data &B11111111
 +
Data &B00010000
 +
Data &B00000000
 +
' "5" -------------------------------------------
 +
Data &B10111110
 +
Data &B10010010
 +
Data &B10010010
 +
Data &B01100010
 +
Data &B00000000
 +
' "6" -------------------------------------------
 +
Data &B01111100
 +
Data &B10010010
 +
Data &B10010010
 +
Data &B01100100
 +
Data &B00000000
 +
' "7" -------------------------------------------
 +
Data &B00000100
 +
Data &B00010010
 +
Data &B00010010
 +
Data &B11111110
 +
Data &B00000000
 +
' "8" -------------------------------------------
 +
Data &B01101100
 +
Data &B10010010
 +
Data &B10010010
 +
Data &B01101100
 +
Data &B00000000
 +
' "9" -------------------------------------------
 +
Data &B00001100
 +
Data &B00110010
 +
Data &B01010010
 +
Data &B10001100
 +
Data &B00000000
 +
' "A" -------------------------------------------
 +
Data &B11111100
 +
Data &B00010010
 +
Data &B00010010
 +
Data &B11111000
 +
Data &B00000000
 +
' "B" -------------------------------------------
 +
Data &B11111110
 +
Data &B10010010
 +
Data &B10010010
 +
Data &B01101100
 +
Data &B00000000
 +
' "C" -------------------------------------------
 +
Data &B01111100
 +
Data &B10000010
 +
Data &B10000010
 +
Data &B01000100
 +
Data &B00000000
 +
' "D" -------------------------------------------
 +
Data &B10000010
 +
Data &B11111110
 +
Data &B10000010
 +
Data &B01111100
 +
Data &B00000000
 +
' "E" -------------------------------------------
 +
Data &B11111110
 +
Data &B10010010
 +
Data &B10010010
 +
Data &B10000010
 +
Data &B00000000
 +
' "F" -------------------------------------------
 +
Data &B11111110
 +
Data &B00010010
 +
Data &B00010010
 +
Data &B00000010
 +
Data &B00000000
 +
</pre>
 +
 
 +
==Autor==
 +
*  [[Benutzer:PicNick|PicNick]]
 +
 
 +
==Siehe auch==
 +
* [[Avr]]
 +
* [[Bascom]]
 +
* [[Interrupt]]
 +
 
 +
[[Kategorie:Robotikeinstieg]]
 +
[[Kategorie:Microcontroller]]
 +
[[Kategorie:Software]]
 +
[[Kategorie:Quellcode Bascom]]

Version vom 18. Januar 2006, 19:36 Uhr

Bascom Tabellen

Baustelle.gif An diesem Artikel arbeitet gerade Mitglied PicNick.

Am besten momentan noch keine gravierenden Ergänzungen / Änderungen vornehmen.

Dieser Hinweis verschwindet wenn der Autor soweit ist. Sollte dieser Hinweis länger als drei Tage auf einer Seite sein, bitte beim Autor PicNick per PM / Mail oder Forum nachfragen ob er vergessen wurde.

$regfile = "m32def.dat"
$crystal = 8000000
$baud = 9600
$hwstack = 32
$hwstack = 64
$framesize = 32
' ---------------------------------------------
' Pixel Timer                 ' 1 mS each pixel
' ---------------------------------------------
Config Timer0 = Timer , Prescale = 64
Const Tim_preload = 131
Dim Timerload As Byte
   Timerload = Tim_preload

   On Timer0 Isr_tim0
   Timer0 = Timerload
' ---------------------------------------------
' Sync Interrupt
' ---------------------------------------------
Config Int0 = Falling
   On Int0 Isr_int0

' ---------------------------------------------
' Patterm dimension
' ---------------------------------------------
Const Pat_rows = 7
Const Pat_cols = 5
'----------------------------------------------
Const Buf_chars = 16
Const Col_chars = Pat_cols * Buf_chars
' ---------------------------------------------
'     0      Left           Top   255
'     |.......|characters|...>.....
' ---------------------------------------------
Const Col_left = 12
Const Col_top = 120
' ---------------------------------------------
'
' ---------------------------------------------
Dim Char_buffer As String * Buf_chars

Dim Charpntr As Word
Dim Charcount As Byte
Dim Pataddr As Word
Dim Pattern As Word
Dim Patcol As Byte

Dim Tim_flag As Byte
Dim Show_flag As Byte
Dim Work_flag As Byte


Dim Charval As Byte
Dim Charidx As Byte
Dim Line_ctl As Byte
Dim Charout As Byte
    Enable Int0
    Enable Timer0
    Start Timer0
    Enable Interrupts

    Pattern = Loadlabel(char_pattern)

' ---------------------------------------------
'              Set Input
' ---------------------------------------------
 Char_buffer = "0123456789ABCDEF"

' ---------------------------------------------
'              Initial conditions
' ---------------------------------------------
   Patcol = 0
   Line_ctl = 0
   Work_flag = 0

   Do
      If Tim_flag = 1 Then
         Tim_flag = 0
         If Show_flag = 1 Then
            Print Bin(charout)
         End If
         Incr Line_ctl
         If Line_ctl = Col_left Then
             Work_flag = 1
             Charpntr = Varptr(char_buffer)
             Charcount = Buf_chars
         End If
         If Work_flag = 1 Then
            If Patcol = 0 Then
' read character & find pattern
               Patcol = 1
               Charval = Inp(charpntr)
               Charidx = Lookdown(charval , Char_table , 16)
               If Charidx < 255 Then
                  Decr Charidx
                  Pataddr = Charidx * Pat_cols
                  Pataddr = Pataddr + Pattern
                  Show_flag = 1
               Else
                  Show_flag = 0
               End If
            End If
' prepare character pattern------------------------------------------
            If Show_flag = 1 Then
               Charout = Cpeek(pataddr)                     ' writout pattern
               Incr Pataddr
            Else
               Charout = 0
            End If
' set next pattern column------------------------------------------
            Incr Patcol
            If Patcol > 5 Then
               Patcol = 0
               Print
' step next character --------------------------------------------
               Incr Charpntr
               Decr Charcount
               If Charcount = 0 Then
' all done
                  Work_flag = 0
               End If
            End If

      End If
   End If
 Loop

End
'------------------------------------------------
Isr_tim0:
   Timer0 = Timerload
   Tim_flag = 1
   Return
'------------------------------------------------

Isr_int0:
   Select Case Line_ctl
   Case Is < Col_top:
      Incr Timerload
   Case Is > Col_top:
      Decr Timerload
   End Select
   Line_ctl = 0
   Return
'------------------------------------------------

Char_table:
'-------"0"-"1"-"2"-"3"-"4"-"5"-"6"-"7"-"8"-"9"
   Data 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57
'-------"A"--"B"--"C"--"D"--"E"--"F"
   Data 65 , 66 , 67 , 68 , 69 , 70


Char_pattern:
' "0" -------------------------------------------
 Data &B01111100
 Data &B10000010
 Data &B10000010
 Data &B01111100
 Data &B00000000
' "1" -------------------------------------------
 Data &B00000000
 Data &B00000100
 Data &B00000010
 Data &B11111110
 Data &B00000000
' "2" -------------------------------------------
 Data &B11000100
 Data &B10100010
 Data &B10010010
 Data &B10001100
 Data &B00000000
' "3" -------------------------------------------
 Data &B01000100
 Data &B10000010
 Data &B10010010
 Data &B01101100
 Data &B00000000
' "4" -------------------------------------------
 Data &B00011100
 Data &B00010010
 Data &B11111111
 Data &B00010000
 Data &B00000000
' "5" -------------------------------------------
 Data &B10111110
 Data &B10010010
 Data &B10010010
 Data &B01100010
 Data &B00000000
' "6" -------------------------------------------
 Data &B01111100
 Data &B10010010
 Data &B10010010
 Data &B01100100
 Data &B00000000
' "7" -------------------------------------------
 Data &B00000100
 Data &B00010010
 Data &B00010010
 Data &B11111110
 Data &B00000000
' "8" -------------------------------------------
 Data &B01101100
 Data &B10010010
 Data &B10010010
 Data &B01101100
 Data &B00000000
' "9" -------------------------------------------
 Data &B00001100
 Data &B00110010
 Data &B01010010
 Data &B10001100
 Data &B00000000
' "A" -------------------------------------------
 Data &B11111100
 Data &B00010010
 Data &B00010010
 Data &B11111000
 Data &B00000000
' "B" -------------------------------------------
 Data &B11111110
 Data &B10010010
 Data &B10010010
 Data &B01101100
 Data &B00000000
' "C" -------------------------------------------
 Data &B01111100
 Data &B10000010
 Data &B10000010
 Data &B01000100
 Data &B00000000
' "D" -------------------------------------------
 Data &B10000010
 Data &B11111110
 Data &B10000010
 Data &B01111100
 Data &B00000000
' "E" -------------------------------------------
 Data &B11111110
 Data &B10010010
 Data &B10010010
 Data &B10000010
 Data &B00000000
' "F" -------------------------------------------
 Data &B11111110
 Data &B00010010
 Data &B00010010
 Data &B00000010
 Data &B00000000

Autor

Siehe auch


LiFePO4 Speicher Test