Talk to BS1USB from C#?
I'm writing a C# program and I want to be able to read from and write to my BS1USB.
I've created a sample program, now running on my BS1USB that prints a random value to the debug terminal.
Here's the DEBUG window output:
VALUE = 4980
VALUE = 4864
VALUE = 4633
VALUE = 4170
Every five seconds, it prints a new random value via DEBUG.
I'm trying to read this same output into my C# program. I've got the serial port open from C#, but I get lots of gibberish.
Here's what the output looks like in my C# program (ideally it would be the same as above):
??????????????????????????????????[noparse][[/noparse]gibberish]??????
????????????????????????????????[noparse][[/noparse]gibberish]????????
??????????????????????????????[noparse][[/noparse]gibberish]??????????
????????????????????????????[noparse][[/noparse]gibberish]????????????
Note that the 'gibberish' block appears regularly, and I believe it's the "VALUE = XXXX" text coming through, because the rate is once every 5 seconds.
I've concluded that my serial settings are wrong -- so I'm reading the 1s as characters. So what are the appropriate settings for the BS1USB to read this DEBUG information? I've scoured the documentation but haven't found anything.
Most of the documentation points to SERIN and SEROUT which is for specific pins, not the built-in USB serial connection, so I'm confused.
Any help? Is there some existing BS1USB <-> C# communication library I just haven't found? [noparse];)[/noparse]
Thanks,
Aerodyno
I've created a sample program, now running on my BS1USB that prints a random value to the debug terminal.
Here's the DEBUG window output:
VALUE = 4980
VALUE = 4864
VALUE = 4633
VALUE = 4170
Every five seconds, it prints a new random value via DEBUG.
I'm trying to read this same output into my C# program. I've got the serial port open from C#, but I get lots of gibberish.
Here's what the output looks like in my C# program (ideally it would be the same as above):
??????????????????????????????????[noparse][[/noparse]gibberish]??????
????????????????????????????????[noparse][[/noparse]gibberish]????????
??????????????????????????????[noparse][[/noparse]gibberish]??????????
????????????????????????????[noparse][[/noparse]gibberish]????????????
Note that the 'gibberish' block appears regularly, and I believe it's the "VALUE = XXXX" text coming through, because the rate is once every 5 seconds.
I've concluded that my serial settings are wrong -- so I'm reading the 1s as characters. So what are the appropriate settings for the BS1USB to read this DEBUG information? I've scoured the documentation but haven't found anything.
Most of the documentation points to SERIN and SEROUT which is for specific pins, not the built-in USB serial connection, so I'm confused.
Any help? Is there some existing BS1USB <-> C# communication library I just haven't found? [noparse];)[/noparse]
Thanks,
Aerodyno
Comments
I get what appears to be random text in the terminal -- nothing like what I see in the DEBUG window I get after I click RUN.
Any advice?
Thanks in advance for your kindness and consideration.
BS1 Documentation says the debug command is:
Asychronous 4800 baud, N, 8, 1
Inverted polarity, Raw Data
Custom packetized format
The information is in a special format and you'll need some kind of program on the PC to interpret it. There is no way to send information to the BS1USB using the built-in USB to serial adapter and there is no other way to get data from the BS1USB using the built-in adapter.
Again, thank you for your kindness and consideration.
-s