| Posted: 08:26am 25 Jul 2020 |
Copy link to clipboard |
 Print this post |
|
I am having great problems tracking down the above error. It is being generated very randomly by an MM-DOS program. Can someone please tell me what the message means?
Here is the code, An HC-12 is connected to Com3 via a Freetronics USB- Serial adapter (JayCar). While a MM170 is connected to the remote end via another HC-12. The MM170 is looking for a number of commands eg "Pressure" and then sending the value back.
Option explicit
Const ComPort = 3
Dim Buff$ As string Dim Tmp As string Dim CurrPress As integer = 0 Dim PrevPress As integer = -1 Dim CntON As integer = 0
Open "COM3: baud=9600" As ComPort
Do While Loc(ComPort) Tmp = Input$(20,ComPort) Loop
Do GetPress Pause 5000 Buff = "" Loop
Sub GetPress Local ThisStrVal As string Local PosPress As integer Print #3, "Pressure" Do While Loc(ComPort) buff$ = buff$ + Input$(200,ComPort) Loop PosPress = Instr(UCase$(Buff),"PRESSURE") If PosPress Then ThisStrVal = Mid$(Buff,posPress+10) PrevPress = CurrPress CurrPress = Val(ThisStrVal) Print Timer;" Pressure = ";CurrPress,CntON If CurrPress > PrevPress + 200 And PrevPress > 0 Then CntON = CntON + 1 Open "WhyPress.txt" For APPEND As #1 If CntON Then Print #1,Time$;" ";Date$;" ";Timer;" ";CurrPress;" Pump ON ";CntON Print "PUMP ON " EndIf Close #1 EndIf EndIf End Sub
If I use TeraTerm instead of MM-DOS all seems fine. Rob White |