How to start with Microcontrollers

Microcontroller Topics
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: How to start with Microcontrollers

Post by Neo » Thu Jan 20, 2011 12:59 am

1.I do have the 16F877A microcontorller. But where can I buy WinPic800 or IC-Prog Prototype Programmer ?? Are they available in Sri Lanka ?
There is no programmer as that. Those are just two programmers that you can use to flash your PIC with several programming methods such as ISP, JTAG, etc... One of the most commonly used ones are called JDM programmer which is based on ISP (In-Circuit Programing). There are two types. Serial and Parallel.

Here is a serial programming circuit which is used by 1000s of PIC users. See Multi PIC programmer. One of our members sell this product for a reasonable fee. If you need assistance on that you can PM me.
2. Can you recommend me a nice book for this ?
There are several articles submitted to ROBOT.LK on this.

See following topics.
Embedded Systems Tutorial
PIC16F84 Tutorial

There are some more you can search on this section.
User avatar
Kevin
Sergeant Major
Sergeant Major
Posts: 40
Joined: Sun Jul 19, 2009 7:49 pm
Location: Sydney

Re: How to start with Microcontrollers

Post by Kevin » Thu Jan 20, 2011 1:07 am

Embedded C Programming and the Microchip PIC
Microcontroller programming: The microchip PIC
Advanced PIC Microcontroller Projects in C

These will give you some sort of project ideas. When you make one practically you will understand what it is. Then you can check the Control Systems & Robotics section for more cool ideas.
Beginning Arduino
Robot Building for Beginners
MAKE: Electronics: Learn by Discovery
User avatar
Enigma
Lieutenant
Lieutenant
Posts: 74
Joined: Sun Jan 16, 2011 12:40 am
Location: Colombo, Sri Lanka

Re: How to start with Microcontrollers

Post by Enigma » Thu Jan 20, 2011 8:41 pm

Neo,Kevin
Thanks guys. Now I have a start.
User avatar
DPX
Sergeant
Sergeant
Posts: 13
Joined: Tue Jun 14, 2011 5:28 pm
Location: Melbourne, Australia

Re: How to start with Microcontrollers

Post by DPX » Tue Jun 14, 2011 8:47 pm

hi. i just wanted to say thx for the tutorial, it is very detailed and well explained. i am trouble seeing any results though. i have wired up the circuit as described and both tried to compile and program the chip on my own as well as using the test hex file posted however i am not seeing any results. i have tried to program using the pickit 3 and it states that the chip has been programmed successfully. any suggestions as to something i have overlooked? would it help to post a screenshot of my current configuration? this is my first attempt at trying to program a mcu so am uncertain on where to go from here.

thank you.
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: How to start with Microcontrollers

Post by Neo » Tue Jun 14, 2011 10:59 pm

any suggestions as to something i have overlooked? would it help to post a screenshot of my current configuration?
I will give you help as much as possible. That's why we made ROBOT.LK ;)

Tell me following things.

1. Have you done any alteration to the circuit diagram?
2. Have you seen the full image of the circuit diagram (led_circuit.jpg) ? A part of it is hidden on the right side (PIN 31, 32).
3. Have you compiled the provided source code?
4. What compiler you have used?
5. What's the oscillator you have used?

From 7. Burning the Hex file to Microcontroller, you need to setup PICKIT3 correctly under MPLab.
User avatar
DPX
Sergeant
Sergeant
Posts: 13
Joined: Tue Jun 14, 2011 5:28 pm
Location: Melbourne, Australia

Re: How to start with Microcontrollers

Post by DPX » Wed Jun 15, 2011 4:58 pm

hi neo. thanks for the quick reply. answers to your questions.

1. Have you done any alteration to the circuit diagram?
No i have tried to follow the diagram as best as i can.

2. Have you seen the full image of the circuit diagram (led_circuit.jpg) ? A part of it is hidden on the right side (PIN 31, 32).
Yes.

3. Have you compiled the provided source code?
Yes I have done a build in MPLab.

4. What compiler you have used?
C compiler in MPLab, the one you described.

5. What's the oscillator you have used?
4MHz Crystal Oscillator.

So just give details. I am building and programming the chip through MPLab IDE. I am using the pickit 3, the programmer and chip both appear to be detected correctly. I have attached screenshots and images of my circuit configuration. Hopefully you can make out what is happening from the images.

Thanks.
circuit1.JPG
circuit1.JPG (36.95 KiB) Viewed 13221 times
circuit2.JPG
circuit2.JPG (37.96 KiB) Viewed 13221 times
Last edited by Neo on Wed Jun 15, 2011 9:54 pm, edited 1 time in total.
Reason: Changed attachments to reduce the size
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: How to start with Microcontrollers

Post by Neo » Wed Jun 15, 2011 9:48 pm

DPX,

I had a look at the images. According to what I see the wiring is correct. However there is a small mistake you made.
You need to fix the Oscillator with 2 caps as much as close to the micro as in the following image. Having wires to connect the Osc to micro will probably give you unexpected problems.
pic_osc.jpg
pic_osc.jpg (73.42 KiB) Viewed 13221 times
Let me know how it goes.

Note: Please put smaller images next time (just as the one I posted). You can open it with Paint and go to Image -> Stretch/Skew and reduce the size by putting 50 to both Horizontal and Vertical boxes under Stretch until the image is reduced to a smaller size as the one I have posted. I changed your attachments as an example.
User avatar
DPX
Sergeant
Sergeant
Posts: 13
Joined: Tue Jun 14, 2011 5:28 pm
Location: Melbourne, Australia

Re: How to start with Microcontrollers

Post by DPX » Thu Jun 16, 2011 4:28 am

hi neo.

i moved the oscillator closer to the chip and am still not seeing anything. any other suggestions?

also apologies for the large images, i thought it would be easier for you to see where the pins are connected.

thanks.
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: How to start with Microcontrollers

Post by Neo » Thu Jun 16, 2011 4:46 am

I think I missed something on the test code (main.c).

Just after the comment "// Configuring PORT A", insert the following line.

Code: Select all

   ADCON1 = 0;	// Make all pins on PORTA as GPIO (Not ADC)
This is updated in the main.c file on the first post.

Please recompile the code and test.

FYI:
Pins on PORT A can be used either as GPIO or ADC. Unless we set them as GPIO, by default those are assigned as ADC.
If we use a port such as PORT B, there is no such setting we need to make other than TRISB and PORTB.
User avatar
DPX
Sergeant
Sergeant
Posts: 13
Joined: Tue Jun 14, 2011 5:28 pm
Location: Melbourne, Australia

Re: How to start with Microcontrollers

Post by DPX » Thu Jun 16, 2011 6:02 am

i have made that line change and done another build however didn't fix the problem. is there any other information i can provide to make things easier?
Post Reply

Return to “Microcontrollers”