Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Can we implement Thread in Arduino Mega2560

Status
Not open for further replies.

imranahmed

Advanced Member level 3
Advanced Member level 3
Joined
Dec 4, 2011
Messages
817
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Karachi,Pakistan
Activity points
6,493
Please let me know can we make Thread for background activity in ArduinoMega2560 like implemented in Android Operating System.
 

I can't help you with the code, I'm not familiar with Android OS or Mega2560 but I think you can 'thread' or 'task' just about any processor. I have even run background tasks on a 6502 processor and PIC16F84 before now. All you need to do is set up a timed interrupt to switch tasks, save the registers and jump to the other code. There you restore its copy of the registers and continue running its code. Pre-emptive task switching is a little more difficult but not impossible on an MCU.

Brian.
 
I can't help you with the code, I'm not familiar with Android OS or Mega2560 but I think you can 'thread' or 'task' just about any processor. I have even run background tasks on a 6502 processor and PIC16F84 before now. All you need to do is set up a timed interrupt to switch tasks, save the registers and jump to the other code. There you restore its copy of the registers and continue running its code. Pre-emptive task switching is a little more difficult but not impossible on an MCU.

Brian.
I download a Thread library it is running but I also used MultiKeypad library, in this library getKey function stops all processing even Thread is not working how to handle this situation. I am struggling but I need hints.
 

in this library getKey function stops all processing
I'm sure there is something too wrong with your code, reading 'keys' are rather non-blocking procedures.
In addition, much likely you don't strictly need to handle with 'threads' with Arduino, you can perform time slotting with timer interrupts.
 
I'm sure there is something too wrong with your code, reading 'keys' are rather non-blocking procedures.
In addition, much likely you don't strictly need to handle with 'threads' with Arduino, you can perform time slotting with timer interrupts.
I am using this attached Keypad library it is blocking my code do you know any other library Multikeypad
 

Attachments

  • MultitapKeypad.rar
    306.6 KB · Views: 117

I did not spent time to check the attachment, in except to confirm that your read key library have houndred lines of code.
I would start with something simplest, as this one, which perhaps has no more than a dozen lines.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top