Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 02:46 02 Jul 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 : COMMS GOTCHA

Author Message
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1094
Posted: 10:36am 07 Oct 2020
Copy link to clipboard 
Print this post

Hi

I spent a considerable amount of time & effort in finding out why one of my HC-12 test links wasn't responding with the correct amount of data.

It was working OK & then sort of stopped sending the full data stream.

I tested & did many things but eventually found the problem.....

DO NOT CLOSE A COM PORT UNTIL THE TX BUFFER HAS SUFFICIENT TIME TO EMPTY.

Delaying the CLOSE #1 command by a second did the trick. I inadvertently had the command immediately after the PRINT #1, command during testing.

Lesson learnt (until next time)

Brian
ChopperP
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6266
Posted: 10:39am 07 Oct 2020
Copy link to clipboard 
Print this post

You can always use LOF() to see whats remaining in the TX buffer
Saves waiting for too long.

Jim
VK7JH
MMedit
 
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1094
Posted: 10:59am 07 Oct 2020
Copy link to clipboard 
Print this post

Thanks for that Jim.

Interesting reading the notes on LOF()  

About 120mS of data being cut off at 60mS. Something I never thought of before.

Brian
ChopperP
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3281
Posted: 01:45pm 07 Oct 2020
Copy link to clipboard 
Print this post

This was changed in Ver 5.05.02 for the Micromite and Micromite Plus:

  Quote  When a serial port is closed MMBasic will now wait for any data in the transmit buffer to be sent before shutting off the port.  Previously the port would have been closed immediately and any characters in the buffer would have been discarded.

Geoff
Geoff Graham - http://geoffg.net
 
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1094
Posted: 10:09pm 07 Oct 2020
Copy link to clipboard 
Print this post

OK, inadvertently loaded 5.05.01 when swapping 28 pinners etc.
Will try '.02.
My apologies...

Thanks Geoff
ChopperP
 
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