Avatar for GoIncremental

GoIncremental

Member since Sep 2014 • Last active Sep 2014
  • 1 conversations
  • 4 comments

Most recent activity

  • in Interfacing
    Avatar for GoIncremental

    Thanks again for all your help - I think the digitalPulse may well work, but if not I'll look at the waveform in more detail.

  • in Interfacing
    Avatar for GoIncremental

    Tried analogWrite() in sequence - but I can't seem to get a consistent reading on my oscilloscope. I'm guessing this is because it's an async function call, and so doesn't wait for one call to finish before executing the next (which was why digitalPulse was so appealing), so I'd be back to using timeout between calls for analogWrite() which then loses the microsecond accuracy.

  • in Interfacing
    Avatar for GoIncremental

    Good idea - I'll give waveform a go.

    I'm finding that as soon as I put more than a couple of lines of logic around the digitalPulses then it starts to throw the timings out, but perhaps I could construct the message payload in advance into an array of functions, and then simply iterate the array and call each function in sequence - that might be worth a try?

    I started looking into the espruino code last night, wondering how hard or otherwise it would be to create a new function based on the digital pulse and / or serial code to encode and transmit a byte array in manchester at a specific baud rate.

    I'm thinking I'd need something like a jswrap_io_manchesterWrite(Pin, byte, baudRate) function in src/jswrap_io.c, then presumably some code in targets/.../jshardware.cpp - Would I need to implement this for mbed, arduino and linux targets as well as stm32?

    I've also not yet worked out how the javascript is translated into the c++ function calls. Am I anywhere near the right track here or should I leave that kind of stuff to the professionals :-) ?

  • in Interfacing
    Avatar for GoIncremental

    I've got a project that requires communicating with a message bus via Manchester encoding at 1.2kHz.

    Essentially this means I need to be able to accurately create pulses of low -> high or high -> low voltage lasting ~417 micoseconds each. (so the total low to high or high to low cycle is 813microseconds)

    I've tried chaining digitalPulse() calls - but hit a few stumbling blocks, in particular the fact that two consecutive '1' pulses will be separated by a short '0' voltage.

    I then looked at setInterval() in conjunction with a function calling digitalWrite() which seemed good down to about 0.5ms (so nearly but not quite the accuracy I need.)

    UART I don't think will work because of the start and stop bits (not needed in my implementation), and then I did start to look at using SPI.send8bit() / SPI.send4bit() just over 1 wire, but either that simply has no chance of working because there's no clock connected or else I couldn't seem to slow the baud rate down sufficiently.

    Any other suggestions out there I might try before I have to resort to embedded C (i.e. arduino) and give up on the arduino / javascript route?

Actions