Advertisement
kabulaewis

paket 2

Feb 17th, 2016
3,728
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $regfile = "reg51.dat"
  2. $crystal = 12000000
  3.  
  4. dim puluhan as byte
  5. dim satuan as byte
  6.  
  7. p0 = lookup (puluhan , angka)
  8. p2 = lookup (satuan , angka)
  9.  
  10. declare SUB tombol
  11.  
  12. sub tombol:
  13. if p1.0 = 0 then goto naik
  14. if p1.1 = 0 then goto turun
  15. if p1.2 = 0 then goto mati
  16. end sub
  17.  
  18. main:
  19. call tombol
  20. goto main
  21.  
  22. naik:
  23. p0 = lookup (puluhan , angka)
  24. p2 = lookup (satuan , angka)
  25. incr satuan
  26. waitms 500
  27.   if satuan > 9 then
  28.   satuan = 0
  29.   incr puluhan
  30.   waitms 500
  31.     if puluhan > 9 then
  32.     satuan = 0
  33.     puluhan = 0
  34.     endif
  35.   endif
  36. call tombol
  37. goto naik
  38.  
  39. turun:
  40.    p0 = lookup (puluhan , angka)
  41. p2 = lookup (satuan , angka)
  42.   decr satuan
  43.   waitms 500
  44.   if satuan > 10 then
  45.         satuan = 9
  46.         decr puluhan
  47.         waitms 500
  48.         if puluhan > 10 then
  49.         satuan = 9
  50.         puluhan = 9
  51.         endif
  52.   endif
  53. call tombol
  54. goto turun
  55.  
  56. mati:
  57. p0 = &hc0
  58. p2 = &hc0
  59. call tombol
  60. goto mati
  61.  
  62. angka:
  63. data &hc0 , &hf9 , &ha4 , &hb0 , &h99
  64. data &h92 , &h82 , &hf8 , &h80 , &h90
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement