Guest
Public paste!

Untitled

By: a guest | Mar 19th, 2010 | Syntax: None | Size: 1.00 KB | Hits: 92 | Expires: Never
Copy text to clipboard
  1. $regfile = "2313def.dat"
  2. $crystal = 16000000
  3. $baud = 9600
  4. $hwstack = 32
  5. $swstack = 10
  6. $framesize = 40
  7.  
  8. Config Portb.0 = Output
  9. Config Portb.1 = Output
  10. Config Portb.2 = Output
  11. Config Portb.3 = Output
  12.  
  13.  
  14.  
  15. Dim Bytel As Byte , Byter As Byte
  16. Dim Intl As Integer , Intr As Integer
  17. Dim Timpl As Long , Timpr As Long
  18. Dim I As Long
  19.  
  20.  
  21. Portb.2 = 0
  22. Portb.3 = 0
  23. Timpl = 0
  24. Timpr = 0
  25.  
  26.  
  27. Enable Interrupts
  28.  
  29. On Int1 Citire
  30. Do
  31. Portb.0 = 1
  32. Portb.1 = 1
  33. For I = 1 To 1000 Step 10
  34.    If I >= Timpl Then
  35.       Portb.0 = 0
  36.    End If
  37.    If I >= Timpr Then
  38.       Portb.1 = 0
  39.    End If
  40.    Waitus 7
  41. Next
  42. Loop
  43.  
  44.  
  45. Citire:
  46. Inputbin Bytel
  47. Inputbin Byter
  48. Intl = Bytel
  49. Intr = Byter
  50. Intl = Intl - 128
  51. Intr = Intr - 128
  52. Intl = Abs(intl)
  53. Intr = Abs(intr)
  54. Timpl = Intl
  55. Timpr = Intr
  56. Timpl = 1000 * Timpl
  57. Timpr = 1000 * Timpr
  58. Timpl = Timpl / 255
  59. Timpr = Timpr / 255
  60. If Bytel < 128 Then
  61.    Portb.2 = 1
  62. Else
  63.    Portb.2 = 0
  64. End If
  65. If Byter < 128 Then
  66.    Portb.3 = 1
  67. Else
  68.    Portb.3 = 0
  69. End If
  70. Return