Read the data in hexadecimal

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    Aufgrund technischer Veränderungen ist der Mailverkehr innerhalb des Forums (Private Nachrichten) nur noch eingeschränkt möglich. Die Einschränkung ist notwendig, um zusätzliche Betriebskosten für das Forum zu vermeiden. Näheres zu den Hintergründen im Thread "Aktuelles zum Forum".Wir bitten um Verständnis.

    Hinweis kann nach Kenntnisnahme deaktiviert werden!

    • Read the data in hexadecimal

      Hi,

      I wrote this code ...

      BASCOM-Quellcode

      1. $regfile = "m1284def.dat"
      2. $crystal = 16000000
      3. $baud1 = 9600
      4. $hwstack = 40 ' default use 32 for the hardware stack
      5. $swstack = 40 ' default use 10 for the SW stack
      6. $framesize = 40
      7. Config Lcdpin = Pin , Db4 = Porta.3 , Db5 = Porta.2 , Db6 = Porta.1 , Db7 = Porta.0 , E = Portc.5 , Rs = Portc.6
      8. Config Lcd = 16 * 2
      9. Config Com2 = 9600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
      10. Open "com2:" For Binary As #2
      11. Config Portd.6 = Output
      12. Declare Sub Bip
      13. Dim Cmdrx As String * 254
      14. Dim Rx_cmd , Ric As Byte
      15. Bip
      16. Enable Interrupts
      17. Cls
      18. Locate 1 , 1
      19. Lcd "HELLO"
      20. Wait 2
      21. Bip
      22. Print #2 , Chr(&H02) ; Chr(&H00) ; Chr(&H02) ; Chr(&H33) ; Chr(&H30) ; Chr(&H03) ; Chr(&H00); 'POWER ON
      23. Cmdrx = ""
      24. Do
      25. Rx_cmd = Ischarwaiting(#2) 'CONTROLLA SE E' STATO RICEVUTO UN CARATTERE
      26. If Rx_cmd = 1 Then
      27. Rx_cmd = Waitkey(#2) 'RITORNA IL VALORE DECIMALE RICEVUTO
      28. Ric = 1
      29. Cmdrx = Cmdrx + Hex(rx_cmd) 'INSERISCE I CARATTERI IN UNA STRINGA FINO A QUANDO LA TRASMISSIONE NON TERMINA
      30. Waitms 1
      31. Else
      32. If Ric = 1 Then
      33. Ric = 0
      34. Bip
      35. Waitms 500
      36. Locate 2 , 1
      37. Lcd Cmdrx '??????????????
      38. If Cmdrx = "06" Then
      39. Waitms 500
      40. Bip
      41. Print #2 , Chr(&H05);
      42. End If
      43. End If
      44. Cmdrx = ""
      45. End If
      46. Loop
      47. End
      Alles anzeigen
      why does not I receive the string correctly?

      es. : 02 00 03 33 30 59 03 58

      receives: 00 03 03 58 ???