last day (15 days later) » 

23:47
-3
Q: Multi-threading AT command in arduino

yeganehhpI have two seperate modules and I want to communicate with them at the same time via AT command . (recieve sms and reply with SIM + get GPS corddinate ) circuit is this : I came through about an example code in Millis and LED's example for multi-threading in Arduino . But how about AT command? I...

sorry it's totally unclear what you mean. What does "communicate" entail? Over what kind of medium/cable/...? what is a "Millis"? "Is it possible?": Probably? That is not a good question; a "yes/no" answer won't help you. "What is your suggestion?" is not actually a specific question at all. So, voting to close as unclear, sorry. Please rewrite your question to be much more detailed AND specific.
@MarcusMüller i add more detail
You didn't add sufficient detail, however. You addressed only one of the five things I mentioned in the my other comment. And among these things are "your questions aren't really sensible questions for this site". Please fix that.
@MarcusMüller i add more detail . but if i said "Millis" for arduino guy they know my language
Please consider moving this to the Arduino Stack Exchange. BTW your question lacks any detail about what you are trying to achieve (communicate at the same time is not really a description). I'm almost sure you don't really want to "multi thread" on an Arduino but just want to avoid "blocking" code. Outline what you want your code to do, or show code you already have that you're having problems with.
23:47
The given example is not really what is generally known as multithreading. That's just manually choosing between 2 blocks of code based on a timer. Yes, you can run any number of concurrent tasks this way, provided there's enough resources.
"Millis" ? .Many of us have worked with and played with UNO boards including me.. Still I didn't get it. I thought you were referring to some theorem/technique in multithreading found by some guy called "Millis". You should learn how to present a problem, to get a proper solution here. Closing.
+ Whatever example you see, it's not multi-threading. UNO cannot perform multi threading cz it has a single core single thread low-end processor inside it. Both statements in main() are still sequential.
@MituRaj thank you Raj . i guess it but needs to be sure about AT commands . so i ask it ... tnx
@MituRaj that's wrong! Also any computer can only do one thing on one core at a time. Performing several tasks with millis() on a single core uC is exactly what multithreadibg is. It has nothing to do with parallelism.
No in multi-threading, you execute two piece of codes parallelly. And you are wrong about "any computer". For instance my computer is quad core in which each core supports two threads. Total 8 threads can be parallelly executed. You confuse your concepts.
@SimSon Many would argue true multi-threading involves some sort of supervisor (hard and/or software) that handles the context switching transparently, so the actual workload code in the thread(s) does not need to know about this and can be written sequentially.
23:47
Task switching is not true parallelism. Its not multi-threading either. Eventhough it gives you an illusion of parallelism.
@MituRaj it does not execute code parallely, multithreading is still a sequential execution and you can do that on an arduino as well.
@Unimportant I agree, but as you stated, it can very well be handled by software. So feel free to implement it on a uC and it will do multithreading. The esp32's sdk inplements exactly that: you can write code just like it was executed in parallel if you use freeRTOS. After all, the esp has only one core available for the developer (the second core is mainly for wifi in this case).
Then as per your logic, every primitive controller including 8051 supports "multi-threading" as well cz it can execute and switch between n number of tasks sequentially.. I rest my case.
@MituRaj Technically, many of these microcontrollers can do multithreading. All you need is a hardware timer that triggers an interrupt periodically and enough flexibility to allow the interrupt handler to switch context. The example given by the OP is nothing like this tough.
@MituRaj yeah, I would argue they can. But it depends on the software you write for it. Performing several tasks will make the controller slower, but you could use a faster mcu. You don't need a high level computer to do any complex task, take the computers used for the apollo rockets per example. They sure had well written code on it.
Okay I get what you are referring to. It is like what is happening in RTOS in which one thread block another to switch. Not sure if it's called "multi-threading". I was talking about interleaved multi-threading in which there are almost no/no dependencies between the threads, so that they execute parallelly without the need of blocking the other.
23:47
Whatever multi-threading is, it isn't really relevant to this question. The article that @yeganehhp refers to in their question is not about multithreading but about creating non-blocking code. Now if they would clarify and add some relevant background to the question we might actually be able to answer it. I still think this belongs in Arduino Stack Exchange where this kind of question comes up often, like in this question.

last day (15 days later) »