It turns out I have only 4 baud rates that are compatible and only 3 possible data bit, parity, stop bit combinations for a total of 12 possibilities. It further turns out 8, none, 1 stop and 8, none, 2 stop bits are interchangeable for what I am doing (I got the correct response at 1 stop even if the device is set for 2 stop bits.)
What this meant was that the SETUPSER was quicker for the format and DEVWRITE was nicer for the baud rate.
(
Hmm, as an aside, DmD 1.4.3 really doesn't like to open when Firefox has this forum open, very strange.)
[So I think the DmD issue may be more to do with not having the VPN connected when the last project opened was using it? Gotta check that more, but with the VPN connected first DmD works as usual. This even though I was only planning to do an offline check.]
I also discovered that $03 for the 12th character is not a solid way of determining if the response was good. If the port settings are wrong I can get this where it should never be. But if I allow 12 bytes to also be a completion, I may still be getting a bad response. I do know I should get @ as the 4th character for this response test. So does anyone have a really nifty bit of code for checking these 4 conditions are all true?
A) starts with $02
B) @ is 4th ASCII character ($40)
C) ends with $03
D) has a length of 12 characters inclusive.
I currently have $03 terminating the STREAMIN, STRSUB to get the 4th character (offset 3), STRCMP to see if it is @ and no check for $02 or length of 12.
A plcnut post reminded me of SS0.len so that will be easy to add.
Gotta go, about to lose utilities.I did a little more digging, STRGETB lets me put those 12 characters into a "buffer" that then lets me do simple = contacts on length, 1st, 4th and 12th characters as expected. This is closer to what I had in mind from BASIC days with LEFT$, MID$, RIGHT$ = those expected characters.
Still open for for more elegant solutions!
I haven't lost communications with it yet even though I have been randomly changing the device's port settings from a Data View via Do-more's serial port and they are both at the office and I am at home. Do-more has found the settings each time just fine. Not bad as long as I don't try to set below 1200 baud.
