Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:51 03 Aug 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 : Configuring a Connected Serial Device

Author Message
jwettroth

Regular Member

Joined: 02/08/2011
Location: United States
Posts: 79
Posted: 04:04pm 12 May 2018
Copy link to clipboard 
Print this post

I would like opinions on how to approach a programming problem. I imagine this is something that some of you have tackled before.

I built a little instrument with a Micromite, text LCD, a couple of buttons, some analog bits and a Bluetooth Serial Module (ST BT2632). Normally it runs stand alone and displays values and squirts out Bluetooth strings. All works well. It has the console port available for editing and updating firmware when required. The Bluetooth module is connected to COM1- pins 4/5. I'd like to be able to talk "through" the micromite to the BT module to change its settings. It has an AT command set that allows this.

I already have a little calibration program that can be run from the console that let's you change constants and test the hardware. I'd like to add some BT configuration options to this program.

Here's the question- how would you approach writing a program that allows the user to go through the console port and talk to the BT module with AT commands. My thought is to take lines in from the console and echo them to the BT modules and take responses from the BT module and echo them to the console. This seems inelegant but will probably work. The default baud rate for the module is 115200.

Is there a clever way to do this? Is there any code around that I could use as an example- maybe something in the library? I imagine that this problem might come up with GPS module configuration too.

Any help appreciated.
John Wettroth
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:24pm 12 May 2018
Copy link to clipboard 
Print this post

  jwettroth said   My thought is to take lines in from the console and echo them to the BT modules and take responses from the BT module and echo them to the console. This seems inelegant but will probably work.

That looks like the simplest and most versatile solution.
If it's part of your main program, all it needs is a signal "xxx" to indicate that you have finished sending commands and to return to the main program.

Sometimes, KISS is really best.

Jim

VK7JH
MMedit
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 11:59pm 12 May 2018
Copy link to clipboard 
Print this post

I use this for testing GPS modules:

OPEN "COM1:9600" AS #1
DO
PRINT INPUT$(1, #1);
T$ = INKEY$
IF ASC(T$) = 26 THEN EXIT DO ' exit on CTRL-Z
IF LEN(T$) THEN PRINT #1, T$;
LOOP
CLOSE #1


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

Regular Member

Joined: 02/08/2011
Location: United States
Posts: 79
Posted: 06:10am 13 May 2018
Copy link to clipboard 
Print this post

Thanks Geoffg- that is simple and elegant and exactly the kind of input I was looking for- amazing that you can do this kind of stuff in 6 lines of code. A tribute to the Micromite. Thanks!
John Wettroth
 
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