C or C++ programming with contikiOS on Arduino Due - c

What I need to do is to compile and run a program written in C/C++ on Arduino.
I'm ok with every open source RTOS if it supports C especially struct.
So I have found contikiOS does that, and tried to get started.
But I guess contikiOS doesn't support Arduino port anymore and Due is quite recent model so that I couldn't find proper information.
If you know any information on it or want me to help, please give me an advice.
Ah, do you have any other recommendation for RTOS?
Thanks.

If what you need is to run a simple c/c++ software, you have to know that the arduino environment support c/c++ code, as explained in the arduino homepage http://code.google.com/p/arduino/
If for your requirements, you need to use a real time operating system, there is a contikiOS version for Arduino (Contiki-Arduino).
Last but not least, if you are a beginner, i would advice you to use a popular RTOS, to find support on internet easily if you need it. Sadly, i am not an expert on that field. But when i google it, i find Duinos, maybe you could have a look on it.

Related

Can you open and edit .c files in the Arduino IDE? And subsequently load them to an Arduino board

I have been trying to open c files in the Arduino IDE (which some people claim is possible).
I have not been able to do so.
How can I program the Arduino in c given that I have a project/files in another IDE? (for example, MPLABX)
I am not sure what you are trying to archive. Is it that you want to open it via the Arduino IDE or also compile the source code?
I am not aware of programming in bare c in the Arduino IDE. But if you're looking into using real c code, it might be a good time start either compiling and uploading via terminal yourself, or use an IDE which is suited for development with micro controllers.
I think you can tell the Arduino IDE to more elaborately log outputs. This would tell you exactly the commands the IDE is using (uses avrdude). Then you can use an IDE/Editor of your choice for coding.
Otherwise, have a look at eg. Atmel Studio. They also support Arduino.
There are two answers in one:
If you really want to use the ArduinoIDE you have to have a basic *.ino file having at least the defines and includes which are in the project file and the reqiured setup() loop() usually whats in main in c goes to loop() in ArduinoIDE. Thats the stoney path because there are some specific issues coming from the philosophy behind ArduinoIDE (help makers with little (no?) programming skills to get started quickly).
If you just need the Arduino tool-chain and want to work more comfortable you have two other options:
EclipseIDE with the Sloeber add-on. Download the Sloeber-AllInOne-Package for an easy start and THEN add the other modules you need (like for web development or similar)
PlatformIO an IDE for micro controller development - there is also a cloud based version for testing around.
All mentioned tools are real open source and available cross PC platform and not a gift from a company like MS for probably later lockin of devs

Modification of J1939 C Library for PIC32

I am working on a project based on J1939 Interface. I am using J1939 C Library for PIC 18 devices (AN930), I am wondering how can I modify this library to work with PIC32MX795F512L device?
I am not the expert level programmer and started working on PIC32 couple of month ago.
Please guide me.
Thank you
If the library was developed the right way, then you only need to find out the clock that controls the timing for the messages; and route it to the right configuration; also you need to identify the buffer where you are going to be receiving the messages, and route it to the library.
That library is outdated and devs stopped updating it. It is designed for C18 compilers. If you want to use that library in XC18 or any other compiler you have to make some major changes in J1939.c file. I do not recommend to spend your time with it, you can implement new one by refering datasheet of your microcontroller, it would be so much easier. Good Luck!

How do I setup a C environment on Windows (and maybe Linux compatible, too)

Short version of question: How do I get started with C programming? Note that I am not asking for a tutorial on learning C language (I can learn that easy enough). I need to setup the environment (I hope I'm asking this question clearly). Here's what I mean:
For my math thesis, I need to write a program in C on Gentoo Linux, using a library called CVODE/SUNDIALS. There is nobody (it seems) in my department who can help me set this up - my professor has left the computer work 100% to me because I have some programming background and he's a math geek. But my experience is with scripting languages (think VBA) and not full, powerful programming languages where you have to link the compiler and libraries, etc. like C.
There is no development environment on the Linux cluster - or at least not that's friendly, and has a debugger - that I've found. So, what I need to figure out how to setup a C programming environment with CVODE library on my PC (Win 7 x64, at little to no cost.
I have found plenty of tutorials on programming in C. I looked up Eclipse, which I have a little bit of experience with, as a development environment, but it's instructions say you need to install a compiler, too.
What I would like is someone to tell me, in simple language that I can understand (which might be the most difficult part of this question) the big picture of what I need and what to do (and maybe even links to where I can find what I need) to set up a C environment with CVODE. If the information is Windows/Gentoo Linux cross platform, even better.
Thank you.
P.S. I did search the site and saw lots of "How do I setup" quesitons, but no C one. Because I know someone will yell at me for that. Also, I don't want to have a convo about whether to use C#, C++, Java, etc. That just complicates the issue - and I need to get this done.
Edit: I have learned a little more since this question and now realize that I left out a key part of the question. The CVODE library and Linux cluster at school use MPI - parallel programming - which is not available on your average, run-of-the-mill PC. So all development must be done directly on the cluster.
Linux: Simple way is to install gcc or g++.
You can write your code in your plain text editor (nano, vim, gedit, kwrite, etc)
Save your file in .c or .cpp extention and type in terminal
gcc filename.c
or
g++ filename.cpp
You said that you want to write c code on Gentoo Linux, as i understand you're not familiar with Linux? The best choice in this case is to:
Install virtualbox in your windows machine (https://www.virtualbox.org/), it's a free software that let you emulate in your desktop another systems like Linux...
Install Gentoo linux on virtualbox, there are a lot of tutorials on the net, for example this video: http://www.youtube.com/watch?v=DUf_1wAPeyA
When you install Gentoo Linux on virtualbox you have all you need to develop C (gcc compiler, gdb debugger...)
Now you can download your library, and decompress it
In general all (Good) Linux libraries come with a 'README' file that contain all instructions for installing the library.
I think you need to do this:
./configure --prefix=/DIRECTORY_YOU_WANT_TO_INSTALL_THE_LIBRARY
make
make install
You can now play with C and you new library, like this:
suppose you create a new file test_lib_ CVODE.c you can compile it like this:
gcc -Wall test_lib_ CVODE.c -o test_lib_ CVODE -lcvode
I assume that the installed library is named libcvode.so
If you have any questions, you can always get help here.
Regards.
I think you should use Code::Block in Linux, it is very similar to Window's Code::Block and it is very easy to debug and other things.
These were all useful answers. I tried pursuing each of them at least a little bit. However, the only reasonable solution seems to be to use emacs on a terminal window. This is because I'm using MPI - yes, I know I didn't mention that in the OP - which can only be done on a cluster.
I am new to this environment and was not aware of the MPI or the affect it would have on my attempt to develop.
I believe I can do better than this if I can figure out X/Windows using Cygwin. But I am a long way from that.
Thanks all for your effort and sorry I can't really award a best answer (I guess).

Invensense IMU3000 with microcontroller PIC

Has anybody experienced using the Invensense IMU3000 with some microcontroller?
I am trying to build the IMU library for a PIC but I am stuck with the dependencies.. any other experience with others microcontrollers will be nice as well!
Basically I don't get whether it is better to take the Visual Studio 2005 project and make the changes there, adding the PIC dependencies (I get stuck..) or compile the whole library in the PIC environment..
Any hint, even with other platforms, would help!
Thank you all!
PC and PIC programming are so very different... Also there are so many pIC variants, they are hugely different from each other, it's hard to answer such an open ended question. However, basically you're writing mathematical algorithms. So write these as ansi c functions, hosted with a load of PC things (dialogs etc) and once they're working, you can move just the math functions over to the PIC - having already got a framework running on the PIC, ready to receive the algorithms. BUT - take care with memory. You have bags of it on the PC, you have to be mean with memory once you work on a PIC. Good luck, enjoy!
While it can be helpful to write code on the PC that will eventually move to the PIC, you will need to make sure that all code that will move has been written with portability in mind. That is, you cannot assume that code that compiles and works perfectly under Visual Studio will work without modification on any other platform.
To run in the PIC, all of the code must be compiled with cross development tools that are designed to target the PIC.
That said, I often develop algorithms and detailed processing code in the PC where a test suite can be easily used to verify its operation, and then recompile it for my target platform.
Incidentally, Google tells me that the IMU-3000 is a MEMS Gyro. It would probably be helpful to include at least the link to its data sheet in the question.

I'm having trouble finding example code for libftdi's mpsse (SPI) mode

This is not a homework problem, though it is a work problem. Where months ago, I would have just written up a specification and the boss would have contracted it out, money's tight. So I'm trying to do this myself.
I'm a weak C coder, and I'm lucky if gcc spits out something that will run without segfaulting, or sometimes anything at all. Still, I manage. Libftdi is built, I've carefuly perused both its example executables/code, and the documentation. But I'm still lost.
Does anyone know of a software project that makes use of its MPSEE mode, that's hooked into an SPI device? Is anyone here slick enough to provide an example? I could really use the help. I don't need this handed to me on a silver platter, but I'm having trouble even getting started. If I could even figure out how to initialize it and send a byte to the chip on the other side of the FTDI ic, I think I might manage to muddle my way through it.
Any help appreciated.
Flashrom can use FT2232 SPI mode: http://flashrom.org/Downloads

Resources