LCD Doesn't Appears

Pytania, kody i porady dotyczące nie tylko Bascom.
ODPOWIEDZ
weako
Posty: 11
Rejestracja: 22 mar 2020, 14:37

LCD Doesn't Appears

Post autor: weako » 06 kwie 2020, 18:21

Hello All Member,
I am newbie in bascom and still learn about bascom language compiler.
I found below code on internet, i trying to tested it on proteus, but it doesn't working, mean is the LCD doesn't appears on.
Could some one here can help me, I want to control from AT90S2313 to TSA5511.
  1.  
  2. $Regfile="2313def.dat"            'Atmega AT90S2313
  3. $Crystal=4000000
  4. $hwstack=30
  5. $swstack=30
  6. $framesize=30
  7.  
  8. $sim
  9. Config Lcd = 16 * 2
  10. Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portd.4 , Rs = Portd.6
  11. Cursor Off
  12. Cls
  13.  
  14. Locate 2 , 1 : Lcd " Test LCD "
  15. Reset Portd.5                                               'LCD R/w
  16. Config Portd = Output
  17. Config Pinb.2 = Input
  18. Config Pinb.1 = Input
  19. Config Pinb.0 = Input
  20. Set Pinb.0
  21. Set Pinb.1                                                  'pull - Up
  22. Set Pinb.2                                                  'pull - UP
  23. Config Sda = Portd.0
  24. Config Scl = Portd.1
  25. Config I2cdelay = 100
  26. Dim Wyswietlanaf As Word
  27. Dim W As String * 6
  28. Dim Reszta As Byte
  29. Dim Dzielnik As Word
  30. Dim Dzielh As Byte
  31. Dim Dziell As Byte
  32. Dim Key As Byte
  33. Dzielnik = 0
  34. Waitms 100
  35. If Pinb.0 = 0 Then : Gosub Rst : End If
  36. Readeeprom Dzielh , 3
  37. Waitms 50
  38. Readeeprom Dziell , 4
  39. Waitms 50
  40. Dzielnik = Makeint(dziell , Dzielh)
  41. Gosub Wyslij
  42.  
  43.  
  44. '------------------------------------------------------------------------------
  45. Do
  46. Waitms 100
  47. If Pinb.2 = 0 Then : Gosub Zwieksz_czestotliwosc : End If
  48. If Pinb.1 = 0 Then : Gosub Zmniejsz_czestotliwosc : End If
  49. Loop
  50. '------------------------------------------------------------------------------
  51.  
  52. Wyslij:
  53. Wyswietlanaf = Dzielnik
  54. Wyswietlanaf = Wyswietlanaf * 5
  55.  
  56.       'Freq = Str ( value )
  57.     ' Freq = Format ( freq , "00.0" )
  58.  
  59.  
  60. W = Str(wyswietlanaf)
  61. W = Format(w , " 00.00")
  62.                   ' Locate 1 , 1 : Lcd Scale
  63.  
  64.             Locate 1 , 1 : Lcd "F:" ; W ; " MHz"
  65.  
  66. Dzielh = High(dzielnik)
  67. Dziell = Low(dzielnik)
  68.  
  69.   I2cstart
  70.   I2cwbyte &B11000000
  71.   I2cwbyte Dzielh
  72.   I2cwbyte Dziell
  73.   I2cwbyte &B10001110
  74.   I2cwbyte &B00000000
  75.   I2cstop
  76. Return
  77. '------------------------------------------------------------------------------
  78. Zwieksz_czestotliwosc:
  79.    If Dzielnik < 2160 Then
  80.       Dzielnik = Dzielnik + 1
  81.    End If
  82.  
  83.    Gosub Wyslij
  84.    Waitms 400
  85. While Pinb.2 = 0
  86.    If Dzielnik < 2160 Then
  87.       Dzielnik = Dzielnik + 1
  88.    End If
  89.  
  90.    Gosub Wyslij
  91.  
  92. Waitms 100
  93. Wend
  94. Writeeeprom Dzielh , 3
  95. Waitms 50
  96. Writeeeprom Dziell , 4
  97. Waitms 50
  98. Return
  99. '------------------------------------------------------------------------------
  100. Zmniejsz_czestotliwosc:
  101.                  If Dzielnik > 1750 Then
  102.       Dzielnik = Dzielnik - 1
  103.    End If
  104.  
  105.    Gosub Wyslij
  106.  
  107.    Waitms 400
  108.  
  109. While Pinb.1 = 0
  110.                   If Dzielnik > 1750 Then
  111.       Dzielnik = Dzielnik - 1
  112.    End If
  113.  
  114.    Gosub Wyslij
  115.  
  116. Waitms 100
  117. Wend
  118. Writeeeprom Dzielh , 3
  119. Waitms 50
  120. Writeeeprom Dziell , 4
  121. Waitms 50
  122. Return
  123. '------------------------------------------------------------------------------
  124. Rst:
  125. Dzielnik = 1750
  126.  
  127. Dzielh = High(dzielnik)
  128. Dziell = Low(dzielnik)
  129.  
  130. Writeeeprom Dzielh , 3
  131. Waitms 50
  132. Writeeeprom Dziell , 4
  133. Waitms 50
  134. Return
Please find attached file for tested.

Thank you.
Regards,
Weako.
Nie masz wymaganych uprawnień, aby zobaczyć pliki załączone do tego posta.
ODPOWIEDZ