Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $regfile = "m8def.dat"
  2. $crystal = 8000000
  3. $hwstack = 40
  4. $swstack = 16
  5. $framesize = 32
  6.  
  7. Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0
  8. Config Portb.1 = Input , Portb.0 = Input
  9. Config Portb.3 = Input
  10. Config Portb.2 = Input
  11. Portb.1 = 1
  12. Portb.2 = 1
  13. Portb.3 = 1
  14.  
  15. Config Lcd = 16 * 2
  16.  
  17.  
  18.  
  19. Deflcdchar 0 , 32 , 24 , 24 , 6 , 5 , 4 , 10 , 5            ' lewo
  20. Deflcdchar 1 , 32 , 3 , 3 , 12 , 20 , 4 , 10 , 20           ' prawo
  21.  
  22. Deflcdchar 2 , 32 , 24 , 24 , 6 , 5 , 4 , 10 , 10           ' lewo ruh
  23.  
  24. Deflcdchar 3 , 32 , 3 , 3 , 12 , 20 , 4 , 10 , 10           ' prawo ruh
  25. Deflcdchar 4 , 6 , 6 , 4 , 14 , 21 , 4 , 10 , 10            ' centrum
  26.  
  27.  
  28. 'Deflcdchar 0 , 14 , 17 , 17 , 14 , 21 , 14 , 4 , 10
  29. 'Deflcdchar 1 , 14 , 17 , 17 , 14 , 4 , 14 , 21 , 10
  30.  
  31. 'Deflcdchar 0 , 32 , 14 , 31 , 21 , 31 , 10 , 21 , 32
  32. 'Deflcdchar 1 , 32 , 14 , 31 , 21 , 31 , 21 , 10 , 32
  33.  
  34. Cursor Off Noblink
  35. Cls
  36.  
  37. Dim Pozycja As Byte
  38. Pozycja = 7
  39. Dim I As Byte
  40. Dim Wysokosc As Bit
  41. Wysokosc = 0
  42. Dim X As Byte
  43. X = 0
  44. Dim Ona As Byte
  45. Ona = 0
  46.  
  47. Lowerline
  48. Lcd Chr(4)
  49. For I = 1 To Pozycja
  50.       Shiftlcd Right
  51.    Next
  52. Wait 3
  53.  
  54. Do
  55.    Cls
  56.  
  57.  
  58.    If Pinb.3 = 0 And Pozycja =< 15 Then
  59.       Pozycja = Pozycja + 1
  60.       Ona = 1
  61.  
  62.       If X = 0 Then
  63.          X = 1
  64.       Else
  65.          X = 0
  66.       End If
  67.    End If
  68.    If Pozycja > 15 Then
  69.    Pozycja = 0
  70.    End If
  71.  
  72.     If Pinb.1 = 0 And Pozycja = 0 Then
  73.    Pozycja = 0
  74.    Pozycja = 16
  75.  
  76.  
  77.  
  78.    End If
  79.  
  80.    If Pinb.1 = 0 And Pozycja > 0 Then
  81.       Pozycja = Pozycja - 1
  82.       Ona = 0
  83.  
  84.       If X = 0 Then
  85.          X = 1
  86.       Else
  87.          X = 0
  88.       End If
  89.    End If
  90.  
  91.  
  92.  
  93.    If Pinb.2 = 0 Then
  94.       If Wysokosc = 0 Then
  95.          Wysokosc = 1
  96.       Else
  97.          Wysokosc = 0
  98.       End If
  99.  
  100.       If X = 0 Then
  101.          X = 1
  102.       Else
  103.          X = 0
  104.       End If
  105.    End If
  106.  
  107.    If Wysokosc = 1 Then
  108.       Upperline
  109.    Else
  110.       Lowerline
  111.    End If
  112.  
  113.    If Ona = 0 And X = 0 Then
  114.       Lcd Chr(0)
  115.    End If
  116.  
  117.    If Ona = 0 And X = 1 Then
  118.      Lcd Chr(2)
  119.    End If
  120.  
  121.    If Ona = 1 And X = 0 Then
  122.       Lcd Chr(1)
  123.    End If
  124.  
  125.    If Ona = 1 And X = 1 Then
  126.       Lcd Chr(3)
  127.    End If
  128.  
  129.    For I = 1 To Pozycja
  130.       Shiftlcd Right
  131.    Next
  132.  
  133.  
  134.    Waitms 100
  135.  
  136.  
  137.  
  138.  
  139. Loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement