OliS

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by OliS

  1. Hi, I want to use DAQfac to repeatedly poll a device for info using the same command, and store this data. This command works fine using putty or teraterm etc, (you get the results and no echo) but when I open a serial monitor window in DAQfac with the same baud settings etc. and try it, I just get an echo of the command and nothing else - do you know what I might be doing wrong? 

    Just to help, let's assume I'm a dumbass who has no idea what they're doing ok, cheers

  2. Brilliant, thanks, works great making control so much better than the trinamic IDE that came with the driver. The final code below for others if helpful:

    function Cmd(address, instruction, type, motor, valuein)
       private tosend
       tosend[0] = address
       tosend[1] = instruction
       tosend[2] = type
       tosend[3] = motor
       tosend[4] = transpose(from.urbLong(to.uLong(from.urwLong(valuein))),0)
       private cks = sum(tosend) & 0xff
    return(chra(concat(tosend, cks)))

     

  3. Hi again, the following line works perfectly:

    device.QBCrig.Poll(ChrA({1, 1, 0, 0, 0, 0, 0, 100, 102}))

    Even though the output, as you said, is just control characters:

    ? ChrA({1, 1, 0, 0, 0, 0, 0, 100, 102})
    

    But using the function as you suggested (I changed 'out' to 'tosend' as I thought that might be conflicting somehow with the 'out' in the poll function but it isnt...):

    function Cmdcopy(address, instruction, type, motor, valuein)
       private tosend
       tosend[0] = address
       tosend[1] = instruction
       tosend[2] = type
       tosend[3] = motor
       tosend[4] = from.urbLong(to.uLong(from.urwLong(valuein)))
       private cks = sum(tosend) & 0xff
    return(chra(concat(tosend, cks)))

    I get this:

    device.QBCrig.Poll(Cmdcopy(1, 1, 0, 0, 100))
    C1136 Timeout: Cmdcopy Line 20: Cmdcopy Line 28:  Line 1

    and the actual output its trying to send is this:

    ? concat(tosend, cks)
    {{1, 0, 0, 0}, {1, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 100}, {2, 0, 0, 100}}

    ...which isnt correct, as there should always be 9 bytes sent and received. I'm confused as C1136 isnt in the user guide, and there are only 9 lines in the function above, so I assume lines 20 (Write(out)) and 28 (throw())refer to the poll function (basically the same as the given one), and there's a problem with the format from the function above. 

    A little more help please?

  4. Hi, I'm trying to make a sequence function to formulate commands to be sent to a TMC stepper motor driver. Each command is in binary in 9 bytes, with some info about addresses, motors etc in each of first 4 bytes, then the value in the next 4 bytes (MSB), then the last being a checksum of the first 8 bytes. A typical command which works is this:

    device.TMC.Poll(ChrA({1, 2, 0, 0, 0, 0, 0, 100, 103})) 

    My function based on the topic above is this:

    function Cmd(address, instruction, type, motor, valuein)
       private string out = format("%03d", address) + format("%03d", instruction) + format("%03d", type) + format("%03d", motor) + from.urbLong(to.uLong(from.urwLong(valuein)))
       private cks = sum(asca(out)) & 0xff
    return(out + cks)

    But isnt quite working - the Long conversion isnt concatenating with the rest of the string properly - could you tell me what I'm doing wrong please? Many thanks!

  5. Hi guys, 

    Sorry for how basic this question probably is, but I've read the serial comms guide, but still can't work out exactly how to send 3 bytes of 1 0 1 in the monitor window - with a <CR> as the end? Do I just write 01 00 01\013 and click send? Do they need spaces between them like that? As this doesn't seem to work and it should I think? Many thanks