LED flasher

Shagas

Joined May 13, 2013
804
While you are waiting for an answer from someone who actually knows about this:

I've never used Pic's but from what I read and seen from this guy :
http://www.youtube.com/watch?v=LjfIS65mwn8

The Pickit3 is just a newer version of the Pickit2 . I actually wanted to start with Pics but my local store didn't have pic kit 2 , they had pickit3 and that came with a prototype board and alltogether cost 100euro versus the 40 euro for the AVRISPmkii so I started with AVR :)
 

bance

Joined Aug 11, 2012
315
The pickit3 is the latest version of the programmer, it supports all the newest chips, but microchip removed some of the features of pickit2, which is in line with their process of making a fully Integrated Development Environment (IDE) that is platform independant. Many pic users were very disappointed when this happened and there is two camps as to which is best....

If you intend to work with the very latest chips then you should probably choose pickit3, since it supports them.

However for the particular application you have in mind the pickit2 will more than suffice. I have a pickit2 and it works very well for me....

The code you write determines what can be done with the chip not the programmer, that is, all the programmer does is provide an interface to your computer to allow you to load the code onto the chip.

See this review and comparison.

Sorry thats the same link as Shagas gave!

HTH Steve
 
Last edited:

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
I listened to the video He certain was very down on pickit 3 and impressed with pickit2 so I am happy and will start working with pickit 2 tomorrow. This is the first time I have worked with forums, I am not sure if this one is a one off, but it is a fantastic resource, thank you
 

Shagas

Joined May 13, 2013
804
I listened to the video He certain was very down on pickit 3 and impressed with pickit2 so I am happy and will start working with pickit 2 tomorrow. This is the first time I have worked with forums, I am not sure if this one is a one off, but it is a fantastic resource, thank you
Microchip (the guys who make Pickit and pics in general) saw that vid that I linked and I think they made improvements to it after that .
 

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
yes its a great video!
I have been trying to install pickit2 but am getting this error when trying to install Install PICkit™ 2 Lessons for the Debug Express 44-Pin Demo Board --

Unable to locate application file 'InstallLessons44P.msi'.

See the setup log file located at 'C:\Users\martin\AppData\Local\Temp\VSD7F7B.tmp\install.log' for more information.

any suggestions how to get round this?
 
Last edited:

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
now trying to install MPLAB IDE and getting this error -1155:c:\users\martin\downloads\mplabtoolsv8.70.msi not found.
I though I would have some trouble learning the code. i did not realise i would not even be able to down load it on to my lap top, has anyone got any suggestions?
 

bance

Joined Aug 11, 2012
315
Any luck with your MPLAB install?

I'm afraid I can't help much, I stopped using windows since XP.

Did you download the software or use the supplied CD?
 

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
No, no luck with the MPLAB install I just keep getting the same error. I have put in a ticket,
I used the CD's. Am I able to download it now that I have bought it as CD's?
 

bance

Joined Aug 11, 2012
315
Of course, it's free to use software, in fact you should download rather than use the supplied, because it's probably much more up to date. However, before downloading anything it may be wise to un-install anything that you allready have.
 

ErnieM

Joined Apr 24, 2011
8,377
No, no luck with the MPLAB install I just keep getting the same error. I have put in a ticket,
I used the CD's. Am I able to download it now that I have bought it as CD's?
Good lord I would never even think of using a CD copy, they are always old to nearly obsolete.

Download the current version. It is free as is most tools there. You may have to open an account, so open one, they are also free.

Aside: Dave's rant on the PICkit III is now 4 years old. I really with people would stop linking to it like it is still relevant. The III is a fine stable and useful tool as any (though I too prefer version II) (and I also have version 1).
 

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
thank you for that I was stuck there I did not even get a reply to my ticket.
I was not sure what to download but i have downloaded these -
PICkit 2 V2.61 Install

PICkit 2 Firmware V2.32? I am unsure whether I needed this one but it would not open

PICkit 2 Debug Express Lessons (PIC16F887) I installed this one ok
i did not see a download for MPLAB IDE.

I will look though this

As yet i do not have a clue what i am doing or looking for.
 

bance

Joined Aug 11, 2012
315
You can download from these links:-

MPLAB V8.91 This is the older IDE I don't know how long support will continue for it, but some people prefer it to the newer....

MPLABX This is the newer completely integrated IDE, I use this one and I think it's ok. Probably if you are going to continue to use micro-controllers this would be better for you to start with this one, since you will learn it from scratch.

If you start with assembly that's all you need.

If you are going to use 'C' you will also need a compiler for MPLABX choose XC8 (it's a little further down the page,) I'm not sure if MPLAB V8.91 comes with a compiler or not! (perhaps someone else knows?)

How to choose which language to use? Well some say that it's better to start with assembly,
because you need to learn about how the registers work, and others say use 'C' because the code is simpler. I am one of those people that likes to know how things work, and because assembly has only 35 or so commands I decided to start with assembly. I haven't moved on to 'C' yet, but will do shortly. Either way there are plenty of tutorials in both languages on the net.

Just one further point, You don't actually need an IDE to programme your pic, you could, if you wished simply write your code in a text editor, then use an assembler to create a hex file and then load your PIC with that using the stand alone programme that came with your programmer. It depends on your confidence/ability to make the various parts of your 'tool-chain' work together. It's often easier to use the IDE. YMMV.

HTH Steve
 

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
Thank you I am downloading MPLAB® X IDE v1.85 and MPLAB® XC8 Compiler v1.20
They are taking a bit of time they have a lot of mbs.
I am unsure what registers are but I guess it would be good to learn how they work so I will probably do the same, start with assembler then later go on to c.
is it possible to complete basic projects using assembler or do you need to go on to c for that?
 

Potato Pudding

Joined Jun 11, 2010
688
If you want to make an LED flasher then you should be able to do it easily in Assembler.

In fact parts of the assembler code you need can be found in the lessons for the 44-Pin Demo board.
 

bance

Joined Aug 11, 2012
315
As Potato Pudding says it is perfectly possible to do anything with assembly, I have written code that runs both an LCD and 7 segment LEDS using assembly and I know that an awful lot more is possible.

However it can become cumbersome and the code is often longer than 'C'. It is also harder to read(especially if it is not well commented,)

Once you have the software downloaded and running, start with lesson 1 which is usually the equivilent of 'hello world', that is light an led in the MCU world. Once you have that programme written, you can use it to test anything else you choose to do by simply swapping out one pin for a resistor and LED.

Keep going and good luck....

Steve.
 

Potato Pudding

Joined Jun 11, 2010
688
Things that are not covered in those lessons that might be good to think about.

For dimming brightness control you will want to use Pulse Width Modulation.
 

donpetru

Joined Nov 14, 2008
185
@lotusmoon, read the message I sent you. Use PonyProg for starters - is the best choice. You can program and PIC's and Atmel MCU.

I wrote below the difference between PIC and Atmel AVR (read carefully):
A moderator may want to create a new topic with this post of mine, which may make it sticky.

1)
Frequency of execution of instructions (FCPU):

PIC: Frequency Oscillator / 4 ---> if I have a 40MHz quartz; instructions are made with 10MHz and there are some that takes 3 x CLK_CPU
AVR: if I have a quartz oscillator frequency of 20MHz, then the CPU is 20MHz, but there are instructions that run at 1.2 or 3 CLK, but most only 1 CLK!

2) Registrers or Register File:
PIC: is a single registre 'W', most instructions pass through it;
AVR: are 32 registrers.

3) RAM:
PIC: - The RAM mcu PIC is divided into the 256Byte memory bank, here are peripheral modules and registers for access need to be in the memory bank;
-
Programs that uses large data structures may not be able to put data into a memory bank - of course there are solutions and C level -- only must consider this. The same happens with a bigger stack, must be defined in two memory bank area for linker (unnecessary complication).

AVR: Linear RAM, it can go anywhere any area of RAM or register

4) Instructions:
PIC:
35-45 instructions, depends on the controller (there are instructions for testing bit);
AVR:
130-135 instructions, bit test instructions are limited to the first 32 registry.

5) Access EEPROM, FLASH:
PIC: in flash can be written only 64byte blocks, to write in eeprom it takes 2 lines of code (I don't know for what reason but is necessary) that apparently do nothing is written in a register (EECON2) once after 0x55 0xAA ... embarrassing!
AVR: can access each byte in flash

6) Interruptions PIN type change / external:
PIC: quite limited, 4-pin with this function (some dsPIC offers thing more interruptions)
AVR: on almost every pin can generate an interrupt.

Example
: if you want to create an application with several buttons to AVR can define for each button in hand an interrupt, while the PIC may not be sufficient to 4 interrupts and be forced to enable global interrupts (enabled global interrupts is a problem in some applications, MCU may be more vulnerable to external EMI perturbations). For this reason it was AVR MCU most used in industrial automation and PIC's are found more in household applications.

7) Interruptions (in general):
PIC: 18F MCU are 2 levels: to the high and low, each interrupt must be set to generate the desired level of course to choose for everyone to have the same level (compatible with 16F) but upon entering the interrupt is high or low should be sought exact source, that by testing flags and deletion their from the software!
For example: if I have 3 timers and USART with interrupt set to low priority when breaks occur, you should test each bit in hand to find out exactly where it came from interruption.

AVR: Is an interrupt vector for each interrupt takes place where salt, there is redirected to the function that handles the event. Interrupt pin only type of change must be looked exactly which initiated the interrupt pin (a big advantage).

8) Peripherals:
PIC: PIC18F6620 part of the new range of MCU PIC's; has 64kB flash and 4KB RAM, so it's not a perfect comparison with ATMEGA88 with only 8KB flash and 1KRAM. PIC has some extra features like auto-baud, but that I did not liked the timers because have maximum prescaller 16 (but they have postscale), modules PWM and input capture not directly related to the timer, by setting are chosen timers for different functions.

AVR: Being waist smaller but still has enough smart peripherals and if we look at a larger AVR we see that there are many more peripherals, like timers, JTAG and something appears missing from the PIC: have potential for debugg by ICD2.

9) ADCs:
PIC: The ADC mcu PIC is more stable, does not take all that noise, but you can not select the channel 1,2,5,6, without select channel 3 and 4 (embarrassing);
AVR: to use all 10bit AVCC must be well filtered and you can select any of the ADC channels.

10) Personal opinion: I think PIC is an inferior architecture, to make a measurement ADC must be configure pretty much, is not optimized for C/C++, or even for ASM, those memory bank complicate, has a limited compiler for PIC18F after 60 days but pretty good performance (not going into details)
AVR is more advanced, faster and easier to use, powerful compiler is FREE --- see Atmel Studio! AVR can protect software written in MCU much simpler.
Microchip has invested heavily in marketing but specialized companies tend to use the AVR's because is more cheaper.

best regards,
donpetru
 
Last edited:

Shagas

Joined May 13, 2013
804
Thanks for the post donpetru !
I started with Mcu's 2 weeks ago and I chose AVR because the AVRISPmkii was 40euro and the pickit3 was 100euro but came with a prototype board .
I thought 60 euro for some prototype board that I might /might not use is not worth it ...
Well what do you know ... marketing strikes again.

Can someone answer the following question please :

What does the following mean? :

PIC 35-45 instructions
AVR: 130-135 instructions

What does it mean by instructions? Built in instructions that we can use??
 
Top