![]() |
Forum Index : Microcontroller and PC projects : Configuring a Connected Serial Device
Author | Message | ||||
jwettroth![]() Regular Member ![]() Joined: 02/08/2011 Location: United StatesPosts: 79 |
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: AustraliaPosts: 6283 |
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: AustraliaPosts: 3292 |
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 StatesPosts: 79 |
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 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |