Skip to content

Bit banging a serial to parallel shift register to drive a 7 segment display is very slow. #7778

Answered by gfwilliams
chrisidle asked this question in General
Discussion options

You must be logged in to vote

Hi,

As I understand it, Microsoft Make:code actually does some compilation on the code you write, so it's going to be a bit faster than running the JS which is interpreted from the text on the fly. Espruino has a bunch of options though...

  • Use the E.shiftOut function which basically bit-bangs for you: https://www.espruino.com/Reference#l__global_shiftOut
  • Just use SPI - hardware or even software SPI should be pretty quick and you can run it on whatever pins you want. You just convert the 16 bit number into 2 8 bit numbers which you can do with new Uint16Array([number]).buffer
  • JIT-compile a JavaScript function - but that isn't in micro:bit builds, it's only official boards: https://www.esp…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by gfwilliams
Comment options

You must be logged in to vote
8 replies
@gfwilliams
Comment options

@fanoush
Comment options

@fanoush
Comment options

@gfwilliams
Comment options

@fanoush
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants