Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
factotum Newbie Joined: 29/10/2017 Location: United KingdomPosts: 18
Posted: 03:14pm 30 Nov 2018
Copy link to clipboard
Print this post
I'm having trouble with limited bandwidth on a LoRa telemetry link that takes data PRINTed to the MM console. One thought was to recode the data in binary thus reducing its size, but I can't see any way of printing binary bytes to the console. Just wondered if there was.
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171
Posted: 03:36pm 30 Nov 2018
Copy link to clipboard
Print this post
have a look at the BIN$() function
it takes a numerical argument and converts it to a stream of 1's & 0's
so
>print 10 10 >print bin$(10,8) 00001010
factotum Newbie Joined: 29/10/2017 Location: United KingdomPosts: 18
Posted: 03:42pm 30 Nov 2018
Copy link to clipboard
Print this post
Thanks, but that's kind of the opposite of what I want to do. But now you've made me think that probably what I need is to use PRINT CHR$(binary byte)
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4133
Posted: 03:53pm 30 Nov 2018
Copy link to clipboard
Print this post
Yes, use CHR$
John
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171
Posted: 04:02pm 30 Nov 2018
Copy link to clipboard
Print this post
ok, to take a binary string of 1s & 0s and print the decimal version you have to process it as a string... like so
> a$="00001111" > print Val("&b"+a$) 15 >
what this does is use the Val function to extract a decimal value from a string, but you change the radix of the string by prefixing with "&b" which means binary.
other prefixes are &h - Hexadecimal, and &o - Octal
DOH! I read your post again ... yes the value you hold in a variable 0-255 in value - just print the CHR$() and you'll get your character.Edited by CaptainBoing 2018-12-02
factotum Newbie Joined: 29/10/2017 Location: United KingdomPosts: 18