View previous topic :: View next topic |
Author |
Message |
kabiru
Joined: 20 Jul 2012 Posts: 6 Location: Nigeria
|
programing |
Posted: Sat Jul 21, 2012 8:04 am |
|
|
Hello everyone, I am new to this forum and also new to microcontrollers programing. I will like members to please help me with some tutorial to start with...
Thanks. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
kabiru
Joined: 20 Jul 2012 Posts: 6 Location: Nigeria
|
|
Posted: Sun Jul 22, 2012 3:40 pm |
|
|
Thank you for the reply pcm programer, i am learning the basics of c language and i am understanding it very well,also thank's for the links.... |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Sun Jul 22, 2012 11:58 pm |
|
|
If you like video tutorials, Lynda.com has a series on C/C++ and while some of it is specific to windows etc, much of the course discusses C fundamentals. Check it out at
http://www.lynda.com/Eclipse-tutorials/CC-Essential-Training/94343-2.html
I have no association with Lynda.com other than through my credit card (I pay the annual fee). Much of the basics he covers will also apply to the CCS compiler we use here.
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Mon Jul 23, 2012 3:49 am |
|
|
I think you first need to be very sure whether micro controllers at this level are the way you need/want to go.
The 'point' about the PIC's as a whole, is a huge family of very cheap chips, ideal primarily for small jobs, or where very large quantities are to be used.
However if (for instance), I wanted to control something simple, and have a simple interface to do this, without having to get involved with soldering irons, or making PCB's, a much better 'learning' starting point, would be something like the Arduino, where interface components are available to 'plug on', or the Raspberry Pi, where a complete board with basic OS, and language is available.
If you decide you do want to go the PIC route, start with a basic C tutorial, and a standard C on the PC first. Get happy that you can write and understand a number of simple programs _before_ getting involved in the extra complexity of working directly with a programmable processor. Then step _slowly_, by getting a pre-built 'development' board.
Best Wishes |
|
|
kabiru
Joined: 20 Jul 2012 Posts: 6 Location: Nigeria
|
|
Posted: Mon Jul 23, 2012 4:48 am |
|
|
This is a very nice forum where different people and different opinions joined together to share ideas, @ Ttelmah I am happy for your advice but I didn't thought about arduino earlier or raspberry pi. A friend advice me to start with pic and now i can understand and write small program like led blinking i think is a good starting point don't you think so? |
|
|
kabiru
Joined: 20 Jul 2012 Posts: 6 Location: Nigeria
|
|
Posted: Tue Jul 24, 2012 8:08 am |
|
|
Hello every one i write a simple led blinking code but when trying to compile their wont be hex file here is the code..
#include<16f877.h>
#fuses HS,NOWDT,NOLVP,NOPROTECT
#use delay(clock=20M)
void main()
{
while(1)
{
output_high(PIN_BO);
delay_ms (1000);
output_low(PIN_BO);
delay_ms(1000);
}
} |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Tue Jul 24, 2012 8:17 am |
|
|
Study the forum - _code buttons_.....
Code: |
#include<16f877.h>
#fuses HS,NOWDT,NOLVP,NOPROTECT
#use delay(clock=20M)
void main(void) {
while(TRUE) { //just nicer style....
output_toggle(PIN_B0); //again nicer style - note the pin name
delay_ms (1000);
}
}
|
Saved as (say) 'test.c', this _will_ compile and generate a hex file, provided you are calling the compiler correctly. What you post, _should work_, except you have called the pins 'BO', rather than 'B0', and the compiler should give an error that the former is not defined. If this is not the problem, how are you trying to compile this?. Through the IDE?. Command line?. MPLAB?.
Note how using the code buttons, and indenting, makes the code easier to read.
Best Wishes |
|
|
kabiru
Joined: 20 Jul 2012 Posts: 6 Location: Nigeria
|
Timer and prescalers |
Posted: Tue Jul 24, 2012 8:32 am |
|
|
Very nice one Ttelmah it works you know i am a beginner that's quit encouraging thanks, and please can you help me with any tutorial to learn how to set timers, in pic? |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Tue Jul 24, 2012 10:39 am |
|
|
I don't want to sound rude or harsh, but you've already been told this is a help you forum not a do it for you one.
All the information you need is in the microchip data sheets for the PIC you're using and the CCS manual.
I suggest you:-
(1) Read the CCS forum guide.
(2) Have a go at getting the timers to do what you want.
(3) Come back to the forum when you are stuck.
When you need help show us that you have tried, someone will usually offer assistance.
Mike
EDIT You will also find loads of useful examples supplied with the CCS compiler, and on this forum. |
|
|
kabiru
Joined: 20 Jul 2012 Posts: 6 Location: Nigeria
|
|
Posted: Tue Jul 24, 2012 11:08 am |
|
|
Thank you |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jul 24, 2012 11:16 am |
|
|
You can learn a lot by reading the forum archives. Learn to use the
forum's search page. It's right here:
http://www.ccsinfo.com/forum/search.php
To search for tutorials on timers, type this into the top box:
And set it to "Search for all Terms" (That's very important).
Click the Search button and you will find lots of articles to read. Most
questions have already been answered and you can find the answers with
the search page. |
|
|
W4GNS
Joined: 28 Sep 2010 Posts: 14 Location: Virginia, USA
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Tue Jul 24, 2012 12:43 pm |
|
|
Also have a real good look at the examples CCS supplies in the 'examples' folder. It will give you practical real world knowledge how to interface almost any device to a PIC.
Please not that you should look at them all, as they all have nice information in them !!
As well, when you have your project open, pressing F11 opens up the CCS help files, allowing fast access to most everything you might need to know, especially for beginner status.
hth
jay |
|
|
|