home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 April / CHIP4_98.ISO / software / ccconrad / basic.exe / CHIP / Programme.Bas / App-Board / rx.bas < prev    next >
Encoding:
BASIC Source File  |  1997-06-16  |  2.1 KB  |  111 lines

  1. '********************************************************************
  2. '
  3. ' C-Control/BASIC       RX.BAS
  4. '
  5. ' Systemvoraussetzungen:
  6. '
  7. ' - Application Board mit angeschlossenem Telemetrieempfaenger
  8. '   und Display
  9. '
  10. ' Schwerpunkt:
  11. '
  12. ' - Empfangen von Funkdaten, (Empfang der Daten von tx.bas)
  13. '
  14. '********************************************************************
  15.  
  16.  
  17. ' *** Daten-Definition ***
  18. define lcd_buf byte
  19. define lcd_param byte
  20.  
  21. define charcount byte
  22.  
  23. define recbyte byte
  24.  
  25. ' *** Definition LCD-Ports ***
  26. define lcd_port byteport[2]
  27. define lcd_rs port[14]
  28. define lcd_rw port[13]
  29. define lcd_e port[15]
  30.  
  31. '*** Programmoperationen  ***
  32.  
  33. #START
  34.  
  35.   charcount = 0
  36.   gosub LCD_INIT
  37.   pause 10
  38.  
  39. #DOWAIT
  40.  
  41. ' auf Byteempfang warten
  42.   wait rxd
  43.  
  44. ' Byte lesen
  45.   get recbyte
  46.  
  47.   charcount = charcount + 1
  48.   if charcount = 17 then gosub LINEFEED
  49.   if charcount = 33 then goto START
  50.  
  51.   ' Byte auf Display schreiben
  52.   lcd_param = recbyte : gosub LCD_WRITECHAR
  53.  
  54. goto DOWAIT
  55.  
  56. #LINEFEED
  57.   lcd_param = 2 : gosub LCD_GOTOLINE        ' Wechsel in die zweite Zeile
  58. return
  59.  
  60.  
  61. '*** LCD_Interface ***
  62. '( muss in jedes Programm mit LCD-Ausgabe eingefuegt werden)
  63.  
  64. #LCD_INIT
  65.  
  66. ' alle ports 0
  67.   lcd_port = OFF
  68.  
  69. ' 8-Bit-Modus aktivieren
  70.   lcd_param=&H38 : gosub LCD_WRITECMD
  71.  
  72. ' mit 8-Bit-Command in 4-Bit-Modus umschalten
  73.   lcd_port=&B00000010
  74.   tog lcd_e
  75.   tog lcd_e
  76.  
  77. ' ab jetzt 4-Bit-Modus
  78.   lcd_param = &H28 : gosub LCD_WRITECMD
  79.   lcd_param = &H0C : gosub LCD_WRITECMD
  80.  
  81. ' Display loeschen
  82. #LCD_CLS
  83.   lcd_param = &H02 : gosub LCD_WRITECMD
  84.   lcd_param = &H01 : gosub LCD_WRITECMD
  85. return
  86.  
  87. ' Zeilenwechsel
  88. #LCD_GOTOLINE
  89.   if lcd_param = 1 then lcd_param = &H80
  90.   if lcd_param = 2 then lcd_param = &HC0
  91.   goto LCD_WRITECMD
  92.  
  93. ' LCD-Kommando
  94. #LCD_WRITECMD
  95.   lcd_buf = OFF
  96.   goto LCD_WRITE
  97.  
  98. ' Zeichenausgabe
  99. #LCD_WRITECHAR
  100.   lcd_buf = &B00100000
  101.  
  102. ' Kommando oder Zeichen an Display senden
  103. #LCD_WRITE
  104.   lcd_port = lcd_buf or (lcd_param shr 4) ' Hi-Nibble
  105.   tog lcd_e
  106.   tog lcd_e
  107.   lcd_port = lcd_buf or (lcd_param and &H0F)  ' Lo-Nibble
  108.   tog lcd_e
  109.   tog lcd_e
  110. return
  111.