Menu

looking for simple example

Anonymous
2019-04-18
2019-06-12
  • Anonymous

    Anonymous - 2019-04-18

    Hi I'm looking for a simple example of reading a byte at a time from a serial port. Currently I have a stream of bytes coming in with no return line, so I'm wanting to add that myself. I'll basically need to read each byte, then calculate a checksum and check the next byte if it's a checksum. If it's a checksum then insert a return line, if not I need to keep adding and checking for a valid checksum.

    Thanks,
    Travis

     
  • Stefan Zieker

    Stefan Zieker - 2019-04-18

    Hi Travis,

    you can find an example script in the attachment.

    Regards,
    Stefan

     

    Last edit: Stefan Zieker 2019-04-18
  • Anonymous

    Anonymous - 2019-05-31

    Hello,

    how is it possible so send one singe byte like 0x06 for <ack> ?</ack>

    Thanks,

    Stefan

     
  • Stefan Zieker

    Stefan Zieker - 2019-05-31

    Hi Stefan

    what do you exactly mean?

    Regards,
    Stefan

     
  • Anonymous

    Anonymous - 2019-06-11

    Hello Stefan,

    what a nice name. I want use script Communicator to communicate with an handheld device. The used communication gives an echo of each Byte. So I have to send single Bytes. For example:
    -> 0x18
    <- 0x06
    But this are only single Bytes. If I use sendString('0x18'), the terminal sends 30 78 31 38
    If I use var Feld = Array(0x18); and sendDataArray(Feld) , the Terminal sends 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    I Just want a single 18.

    Thanks,

    Stefan

     
  • Stefan Zieker

    Stefan Zieker - 2019-06-11

    Hi Stefan

    yes a really nice name :-).
    If you use sendString('0x18') then you send the string 0x18 (4 characters). If you create an array with Array(0x18) then you create an empty array with the size of 18 (empty) entries.

    If you just want to send a single byte you have to do this:

    var data = Array();
    data[0] = 0x18;
    sendDataArray(data);
    

    Regards,
    Stefan

     
  • Anonymous

    Anonymous - 2019-06-12

    Hi Stefan,

    Thanks a lot!

    Regards,

    Stefan

     
  • Anonymous

    Anonymous - 2019-06-12

    Hi Stefan,

    Thanks a lot!

    Regards,

    Stefan

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.