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.
|
Forum Index : Microcontroller and PC projects : How to TX Raw Hex data in MM Basic?
Author | Message | ||||
JohnL Senior Member Joined: 10/01/2014 Location: SeychellesPosts: 128 |
RE: MM Basic, Duinomite with 4 com ports including 2 hardware ports. Need to output raw hex bytes on serial com port, no CR and no LF. Advice would be appreciated. Thanks |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6101 |
To send the data PRINT chr$(x); where x is the value from 0-255 and the semicolon suppresses the CR/LF if you need the data to appear as hex PRINT HEX$( x ); Jim VK7JH MMedit MMBasic Help |
||||
JohnL Senior Member Joined: 10/01/2014 Location: SeychellesPosts: 128 |
Perfect, works like a charm! Thanks Jim Cheers |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Or [code] Print right$("0" + hex$(x),2); [/code] when you want to have a leading zero. The values will then always be 2 characters long. You will probably need a separator otherwise when a character is missed the receiver will interpret the values wrong. Easiest is to use a space. [code] Print " " right$("0" + hex$(x),2); [/code] Microblocks. Build with logic. |
||||
JohnL Senior Member Joined: 10/01/2014 Location: SeychellesPosts: 128 |
Thanks TZ, Will try that later. At this stage I am using ASC(INPUT$(X, #Y) for receiving same single byte data by a MMbasic slave. Any other suggestions? |
||||
Print this page |