Can anyone suggest a software package, if one exists, to simulate a PIC. I want to learn more about them and would like some software where I could design a hypothetical circuit and add "virtual" code to the PIC to see how it responds. Freeware, shareware would be preferred, but it really doesn;t matter.
You can 'almost' simulate the PIC using the freeware package supplied by its creators. (Microchip). The software is called MPLAB, and can be downloaded from their website. What you can do with it is compile and simulate your own programs on the screen, simulating inputs, and looking at the outputs the chip gives in response. You can also look 'inside' the chip, and see the values of the counters inside it as the PIC executes each instruction. The only thing you cannot do is connect virtual circuits to the inputs and outputs. MPLAB allows you to program the PIC in assembler, or if you want to you can program it in C using the PICCLite program, which can also be downloaded for free. (Note that PICCLite is a cut down version of a professional program, and the PICs you can use are limited though) Learning the MPLAB software is a good idea anyway, because it is a very common (and possibly the best) compiler for PIC microprocessors, and can be used to design code for any of the common PICs. As a final note, you can make a basic programmer and some test circuitry for well under £10 these days. Given that the PICs are re-usable, its pretty cheap to test your programs for real.
Thanks for the info. I am a bit rusty with C but I may give that a whirl. Assembler is something I have only briefly looked at. I stick to VB for the most part. A VB to PIC compiler would be awesome. I will download the prog and give it a try. The potential for using PICs seems almost limitless. I can't begin to count how many projects I have scrapped because I could not figure out how to control them.
Assembler is dead easy; there are only 35 instructions in the progamming language. I also find it simpler than C when programming PICs, because it can easily manipulate individual output pins. The only really important things that are much harder in assembler than C are Multiplying and Dividing, since there are no Assembler instructions that can do these functions. I have found afew links for you: Download Page for MPLAB Download Page for PIC C Lite: (link to download page at bottom of this page) For some help with Assembler programs (most of it is fairly advanced stuff), the PICLIST website has a decent code library. (http://www.piclist.com/techref/microchip/routines.htm) Finally, I started out learning how to program the PIC using a book called: PIC: Your Personal Introductory Course. (2nd edition) It is written by John Morton, and is sold by Amazon books. Whilst it is now a little dated, much of what is said is still correct, and it is still a useful reference.
Bodger be telling it like it is. Assembly is the way forward, high level languages aren't needed on the PIC, enless your doing too much floating point. There is PIC BASIC which i've never used, but have been reliably told is crap (by someone who has an excellent taste in coffee, so they must be right). High-Tec C compiler seams to be the industry standard at present, but myself i ONLY ever use MASM, once u get ur head round macros its awsome, and there are only TWO things that anoy me about the IDE + Lang. (this is a really amazing score). (the two things are, it dosen't properly define a label as anything differn't to a macro invoke, stupid. Also if you double click a word, rather than highlight that word, u toggle breakpoint, again, stupid, toggle breakpoint should be in the border!) If you have a few pennies to spare this xmas, i highly recomend getting an ICD 2, they rock, let u see most of ur problems, they are the #1 accessory, #2 been a 'scope.
I would like to add that multiplying and dividing have been well explained as macro subroutines in the microchip appnotes. Also, 18F series has hardware single instruction multiply.
Thanks for all the info. I downloaded the prog and played with it a little. Seems straight forward, but I know little or nothing about PICs themself except for the AMTEL (sp) type which seems MUCH eaiser to use then the microchip stuff. The web site is a bit overwhelming with 100's of chips to choose from. I know this has been discussed to death, but once again where is a good starting point for someone with prog experience (not assm) and very basic electronic design knowledge? For the most part I am not looking to build intgeractive devices with displays etc. I like bouncing and flashing lights and like to build projects like that for my kids. It would be nice to take some of the EL stuff and UV LED stuff and make it a bit fancier or flashier for the kids.
A few years ago I would have said that the 16F84 was a good chip to start with. However, it is now rather outdated, and expensive for what it is. If I were starting out with PICs today, I would probably start with the PIC16F628-20/P, which is (almost) pin-compatible with the 16F84. This chip has twice the program memory, loads more RAM, can be run at higher clock speeds, has a built in USART, etc. etc. and is actually cheaper than the 16F84. (about £3 per chip) The PIC16F628 is also one of the few PICs that work with the free version of PICC Lite, too. One of the only things that is missing from the PIC16F628 is an A/D converter. If you want one, you'd be better off going with one of the larger PICs, such as the 16F877, which has an A/D converter. (It costs about £5)