Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:30 14 Nov 2025 Privacy Policy
Jump to

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 : Error : Writing to port: The semaphore

Author Message
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
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
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025