You'll probably find C easier and quicker than asm as your programs get more complex. I love asm, but C is quicker and easier to write and to read (especially after a few weeks/months of not looking at a given piece of code).1- To interact sensor and servo motor togather, what is recommend as a programming language C or assembly in term of difficuilties?
Why not a 18F1320? Any 18F is fine though. They're all very similar.2- If C is recommend, Can you suggest PIC18F to start? and Some link to start learning C language for that PIC?
Interesting, So if i take a course in C language. It will be easy for me to program PIC using C language.
BTW, I am wondering if I am programming with C does i need to refer to PIC manual while programming?
Q2> Can you suggest a link to learn Basic of C language for PIC Programming.
Thanks in advance
Not only great advice, very well stated!You'll probably find C easier and quicker than asm as your programs get more complex. I love asm, but C is quicker and easier to write and to read (especially after a few weeks/months of not looking at a given piece of code).
Why not a 18F1320? Any 18F is fine though. They're all very similar.
If you've never programmed in C before at all, you might be better off learning C on the PC. That way you can follow one (or several) of the bazillions of tutorials out there. You have easy to use stdin and stdout that way, so you get good, easy to use feedback. With a PIC you have to write your own (or at least know how to use the libs to get the IO working). When you're brand new to the language that can be difficult. Get a feel for the language on the PC and then move to PIC.
You can set up gcc under windoz, but even setting it up has quite a steep curve...If you run Windows, you'll have to find a C compiler. I do not know what's available for free. Compilers are expensive!!! There are probably some good demos available though.
If you run Linux, all the languages you need are probably already installed. Full C compiler and Python and Ruby and whatever else your distro has packaged with it. Everything is free!If you're a programmer, Linux is the greatest! SO much nicer and easier to deal with than crappy Windoze.
Don't bother with C++, which is a superset of C. C++ is C plus a bunch of object oriented stuff added on. You won't normally use the OO stuff on a PIC.
Interesting, So if i take a course in C language. It will be easy for me to program PIC using C language.
See Lefty's good advice.BTW, I am wondering if I am programming with C does i need to refer to PIC manual while programming?
Q2> Can you suggest a link to learn Basic of C language for PIC Programming.
Thanks in advance
Ya, I tinkered with that once. Gave up and used a "liberated" copy of Borland C instead.BeeBop said:You can set up gcc under windoz, but even setting it up has quite a steep curve...
Not only great advice, very well stated!
You can set up gcc under windoz, but even setting it up has quite a steep curve...
when I googled: windows + C compiler + free
there were tons of links, the first:
Free C / C++ Compilers and Interpreters (thefreecountry.com)
Ya, I tinkered with that once. Gave up and used a "liberated" copy of Borland C instead.
Setting up Python and the PyGame libs on windoze is also not as simple as it could/should be.
I love Linux for programming (web dev stuff too). Everything is free and either already installed or just a few clicks away. Very good tools. And the OS is well documented - not all "trade secrets" like windoze.
Microsoft's visual studio would be a very good tool to learn C. It has a feature call intellisense that makes coding a bit easier. One feature will show you the .h code associated code in a .c file. For example in the editor you can clickTIMER_INT_OFFand#define TIMER_INT_OFF 0b01111111 // Interrupts disabledwill show up in the code definition window. There is also a completion tool where you type the first few characters and you can pick from a list of variables that you have defined. Great to have around when you do not know if you used ledOn or ledsOn sort of thing.
A simple but handy item is code snippets. You store bits of commonly used code as snippets that you select from a menu to paste into your code.
Some people will say it is a crutch. It may be, but it is a useful one. The Visual Studio IDE is more complex, everything is a tradeoff.
The C++ version will compile normal C code.
When you switch to PICs and MPLAB you can run both MPLAB and visual studio at the same time, each with its own project file in the same folder. This allows you to edit the code in VS and compile and run it in MPLAB. MPLAB has an option to automatically reload files if they are changed externally. It works fairly well.
3v0
That's one of the things I really liked about the Swordfish IDE was the helpful modules library whenever you use a module.
When I started with PASCAL I really found this now free editor / interpreter really handy.
Alice Pascal
PC and ATARI! versions.
There is also a setting in VS that will load files change outside (in MPLAB) but it has a nag box that pops up asking if you want to do so. Could be a setting to not show the box.Hey WOW! I have got to play with that one. Excellent, thank you!
Those can be installed on Windows by running two installers.Setting up Python and the PyGame libs on windoze is also not as simple as it could/should be.
There is also a setting in VS that will load files change outside (in MPLAB) but it has a nag box that pops up asking if you want to do so. Could be a setting to not show the box.
3v0
Some good C tutorials here. **broken link removed**
For a free C/C++ IDE, there's Code Blocks.
It's being updated and comes with the gcc compiler. Code::Blocks
Maybe things have changed for the better. I did it some years ago and I vaguely remember it being quite a pain in the butt.Those can be installed on Windows by running two installers.
Ya, Windoze has the best microcontroller tools. I've done some stuff with Piklab, but I run a windoze box at my electronics table. It does dual-boot Ubuntu, but normally runs Windows.futz, have you manage to get some "good" gui for develop/compile/program on linux .. anything I tried was just not "worth it" .. not to mention that I never tried gcc for pic.. should do it, and compare the asm output from mikroC/C18/CSCC and GCC .. might get interesting results .. if you know of any IDE .. (like eclipse plugins or some other app), please enlighten me - I have piklab, but never managed to get anything done using it
I hate to sound like a broken record, but...- for 12F, 16F ... you will not find any "cheep&good" compiler, I personally use mikroC and CSC C ... both are very good and both cost ~100E, there is also swordfish C but I never tried it hence I cannot compare it to these two (purchased mikroC as it is local company and then got CSC C with some dev kit I purchased for USB FT* ...)
futz said:If you're looking for a C compiler I recommend SourceBoost BoostC. The demo is only code size/RAM limited - works for all supported PICs. And when you hit the limits of the demo, a full license for the compiler is only about $75! Compare with C18's price of ~$500 and PICC's price of ~$1000. It's a no brainer! Better yet, BoostC comes with both 16F (supports some 12F also) and 18F compilers.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?