Can someone who is good with PICs give me some tips? I want to start out and I kind of want a brief tutorial on using the types of PICs discussed around here.
I've seen one before called an OOPIC; is it very different from other PICs?
(This needs to be a sticky, I think)
Micro-controllers
Moderators: Sparky, Moderators
- MillenniumFalsehood
- Posts: 17033
- Joined: Tue Nov 16, 2004 5:23 pm
- Location: Wichita, KS, USA
- Contact:
Micro-controllers
If a redhead works at a bakery, does that make him a gingerbread man?
Ponies defeat a Star Trek villain? Give them a Star Wars award ceremony!
Ponies defeat a Star Trek villain? Give them a Star Wars award ceremony!
I've used rather a lot of Pic-type controllers. What do you want to know?
OOPIC = Object Oriented PIC. More of a programming language/environment than a species of chip. You can program them in C, and BASIC, as well as Assembly language. I use assembly language because a. it isn't that difficult and b. it allows exact control of timing. In some cases that is important.
OOPIC = Object Oriented PIC. More of a programming language/environment than a species of chip. You can program them in C, and BASIC, as well as Assembly language. I use assembly language because a. it isn't that difficult and b. it allows exact control of timing. In some cases that is important.
- Pat Amaral
- Posts: 3730
- Joined: Fri Jul 12, 2002 2:44 pm
- Location: Ok, I'm here. You can start now
123 PIC Microcontroller Experiments for the Evil Genius by Mike Predko
I bought the programmer (PIC Kit 1) that was recommended in the book. The kit comes with the required software and a lot of extra info. It's pretty easy to get through.
I bought the programmer (PIC Kit 1) that was recommended in the book. The kit comes with the required software and a lot of extra info. It's pretty easy to get through.
Pat A.
=============================
50% Nerd, 50% Geek, 100% Cool
=============================
50% Nerd, 50% Geek, 100% Cool
- MillenniumFalsehood
- Posts: 17033
- Joined: Tue Nov 16, 2004 5:23 pm
- Location: Wichita, KS, USA
- Contact:
I'd like to know a) the most cost-effective PIC(i.e., the most bang for buck), b) how they are programmed, c) how many LEDs can the aforementioned PIC support, d) how small they can get, e) can the aforementioned PIC control both motors(stepper motors) and LEDs at the same time, and f) can I get several effects from the same microcontroller?jwrjr wrote:I've used rather a lot of Pic-type controllers. What do you want to know?
Tall order?
And one more thing: is there any freeware that can program a PIC(I'm a cheapskate, but that's helped me keep money in my wallet )
Ah. I had seen an incredible website that dealt with programming an OOPIC of some kind(I had it bookmarked. Maybe I can find it again; it had a lot of projects that would be useful for modelers).jwrjr wrote:OOPIC = Object Oriented PIC. More of a programming language/environment than a species of chip. You can program them in C, and BASIC, as well as Assembly language. I use assembly language because a. it isn't that difficult and b. it allows exact control of timing. In some cases that is important.
If a redhead works at a bakery, does that make him a gingerbread man?
Ponies defeat a Star Trek villain? Give them a Star Wars award ceremony!
Ponies defeat a Star Trek villain? Give them a Star Wars award ceremony!
Not especially...MillenniumFalsehood wrote:I'd like to know a) the most cost-effective PIC(i.e., the most bang for buck), b) how they are programmed, c) how many LEDs can the aforementioned PIC support, d) how small they can get, e) can the aforementioned PIC control both motors(stepper motors) and LEDs at the same time, and f) can I get several effects from the same microcontroller?jwrjr wrote:I've used rather a lot of Pic-type controllers. What do you want to know?
Tall order?
A: My favorite PICs
For most stuff I use 16F-series controllers. There's a lot of variety to this line in terms of number of I/O pins and so on. You do have to be careful when selecting your controller and how you're going to hook it up, 'cause sometimes some pins will be input-only, or an open collector output, or will require special programming parameters to use them as an I/O pin...
My usual favorites these days are the 16F648 and '684. The 648 has more I/O lines than the '684 - I think the '684 is supposed to be a modern variant of the 16F84, which for a long time was the "standard" for hobby projects... Both also have an option to clock them from an internal oscillator - which means you can run 'em with no external components.
How small can the get? Well, the regular PICs are also available in surface-mount sizes, which makes them pretty small (I fit one 16F648 in each nacelle of my 1:1000 Enterprise) and if you need smaller ones - some PICs are really tiny...
B: How they are programmed
I use kitsrus.com "Kit 182" to program my PICs. It's a really small (about 1" x 2", in the case I installed it in) programmer circuit - comes pre-built because it's mostly surface-mount. It connects via USB and appears as a serial device - you talk to it with a published protocol (kitsrus provides a software application for talking to the programmer - I wrote a Python script so I could do it on Linux) and you connect it to your PIC via "in-circuit serial programming"...
ICSP basically means you make a couple provisions in your circuit so that you can attach a PIC programmer to it, rather than having to remove your microcontroller to reprogram it. For small projects like model stuff I usually don't socket my controllers - so ICSP is the way to go. But because of the small size and convenience of the K182, it's become my chosen method for programming PICs even in cases where it would be easy to pull the PIC from the circuit and program it (I also have K149, which is a larger programmer with a ZIF socket for programming - it can also program a wider variety of devices, but it requires an 18V external power source... K182 draws all the power it needs from USB.)
C: How many LEDs?
Assuming you hook just one LED to each output, probably about 18 for the 16F648. (I don't remember offhand - I'm guessing one or two of those 20 I/O lines are input-only...) Each output is rated to 20mA, so you can direct-drive an LED with it.
If you want to get fancy, you can hook up a whole matrix of LEDs - like use 18 I/O lines to connect to an 8x10 grid of LEDs - but that makes programming more difficult.
The combination of different stuff you can control depends mainly on your programming skill. You're writing a sequential program that may have to control several things that you want to appear to be operating independently... And it gets more complicated if you want to control LED brightness with a technique like PWM, too - but it's all doable, just write the code...
Yes. I use only free software for my PIC code development - GPASM to compile the assembly, my own Python script to send the compiled code to the PIC (there are other free software options for talking to the KitsRUs programmers - plus their own option, Micropro, though that only works on Windows...)And one more thing: is there any freeware that can program a PIC(I'm a cheapskate, but that's helped me keep money in my wallet :) )
---GEC (三面図流の初段)
There are no rats.
The skulls eat them.
There are no rats.
The skulls eat them.
a. cost-effective? That depends on what you want to do with them. I've used several different ones of the pic12F series and also the pic18F series. The '12F is an 8 pin chip which can be set up as 2 pins for power, 1 input, and 5 pins that can be either input or output. Many of then sell in single quantities for between $1 and $2. Lower price in quantity (i.e. 10, 25, or higher). The '18Fs are much more powerful, and you can put a (or more than one) lookup table in the program space. Both varieties (and many of the '16Fs) have an oscillator onboard. The accuracy of the frequency is limited, but you are building a model, not a clock.
b. Programming. There are advantages to using either authentic Microchip programmers or clones of them (found on Ebay and other places). I use an authentic Picstart Plus and an ICD2 clone. The biggest advantage is g. software. MPLAB IDE can be downloaded for free from the Microchip website. It includes a limited C compiler. I use assembler. There are not too many instructions (as few as 35), and I use less than 1/2 of them anyway.
c. Each output pin is rated at 25ma max. Connect the output to a mosfet (2N7000 or BS170) and control 10 leds or more. I've controlled Neon tubes with the right transistors.
d. Small? As mentioned above, the '12f is an 8 pin chip available as a DIP or surface mount package. If you want really small, the pic10f series comes in a SOT23-6 package (if you don't know what that means you probably shouldn't mess with them.
e. Can you get several functions from one chip? That depends on how good of a programmer you are. The chip will be capable of it.
b. Programming. There are advantages to using either authentic Microchip programmers or clones of them (found on Ebay and other places). I use an authentic Picstart Plus and an ICD2 clone. The biggest advantage is g. software. MPLAB IDE can be downloaded for free from the Microchip website. It includes a limited C compiler. I use assembler. There are not too many instructions (as few as 35), and I use less than 1/2 of them anyway.
c. Each output pin is rated at 25ma max. Connect the output to a mosfet (2N7000 or BS170) and control 10 leds or more. I've controlled Neon tubes with the right transistors.
d. Small? As mentioned above, the '12f is an 8 pin chip available as a DIP or surface mount package. If you want really small, the pic10f series comes in a SOT23-6 package (if you don't know what that means you probably shouldn't mess with them.
e. Can you get several functions from one chip? That depends on how good of a programmer you are. The chip will be capable of it.