Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Pthread.h on ATmega32 micrcontroller

  1. Feb 20, 2012 #1
    Ok This might be really stupid but I have been finding conflicting answers and getting very confused.

    I am trying to program an Atmel ATmega32 using embedded C. This is my first time and I wanted to know if I can use threads in the programming.

    Thanx!!
     
  2. jcsd
  3. Feb 21, 2012 #2

    jhae2.718

    User Avatar
    Gold Member

    IIRC, most microcontrollers don't do threading. You can simulate it using interrupts, I believe.

    Quick test of avr-gcc:
    Code (Text):

    me@linuxbox:~$ avr-gcc test.c
    test.c:1:21: error: pthread.h: No such file or directory

     
     
  4. Feb 21, 2012 #3

    rcgldr

    User Avatar
    Homework Helper

    Looking at atmel's documentation, it's a single cpu. If you want to do multi-threading you'll need to write or obtain a multi-threading operating system for the atmega328. The only operating system for the atmega328 I see in this wiki article is BRTOS, which is apparently free (MIT license).

    http://en.wikipedia.org/wiki/List_of_real-time_operating_systems

    link to brtos from wiki article:

    http://code.google.com/p/brtos/

    It's also possible that your atmega328 came with software that included a multi-threading operating system.
     
    Last edited: Feb 21, 2012
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook