![]() |
Forum Index : Microcontroller and PC projects : Using Bin2Str$ in function.
Author | Message | ||||
Greg Fordyce Senior Member ![]() Joined: 16/09/2011 Location: United KingdomPosts: 153 |
Is it possible to use Bin2Str$ in a function? Sample code and console output showing syntax error. Cheers, Greg. > list Option default integer Print Bin2Str$(uint16, 12345) a = crc("uint16", 12345) Function crc(parm$, x) Print parm$, x crc = x * 2 Print Bin2Str$(parm$, x) End Function > run 90 uint16 12345 [10] Print Bin2Str$(parm$, x) Error: Syntax > |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
The first call to Bin2Str$: Print Bin2Str$(uint16, 12345) uses the predefined value unit16 as the type qualifier. The second call appears to use the string "uint16" as the type qualifier. I haven't used the Bin2Str$ function before, I may be having a seniors moment with this post ![]() Mike. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
I don't think the function evaluates the first paramater Do something like this You only need to code for the options you are likely to use. Jim VK7JH MMedit |
||||
Greg Fordyce Senior Member ![]() Joined: 16/09/2011 Location: United KingdomPosts: 153 |
Thanks Jim, I hadn't thought of using the case statement, that solution will work for me. Cheers, Greg |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |