> Ok, I am looking into the world of electronics and I really like doing > this sort of stuff. Let me warn you...I'm only 16 and you're probably > thinking I should have some socializing to do or something, but...well you > get the point. Yeah, I get the point. I should have had some socializing to do when _I_ was 16, but the Commodore 64 seemed like so much more fun... My advice: do the socializing now, otherwise you'll get too hooked on micros/comp- uters and never figure out girls/women. [half-kidding] > I have purchased a basic stamp and constructed the > programming mechanism for it and have built several of the application > note projects as well as some of my own. This included the serial A/D > which I was very proud of because I interfaced it to my calculator (HP > 48G) (sorry about that, I just had to tell someone about that who might > somewhat appreciate it). Cool. > Anyway, I have been looking at other > microcontolers, and I have been thinking about purchasing a pic > programmer. If I do get one, what would you guys (and gals, gotta be > P.C.) recommend > that I get, I have been searching around web sites, and I found some good > stuff at ITU technologies, one of them being a "Warp 3" programmer that > claims to program everything (for around $130) and a less expensive one > that doesn't program > those exotic ones like the 14000 and what-not ($50). Well, I personally like the 16C84/16F84 [latter essentially replaces the former] as an easy development machine. What I did when I was starting out with PICs was to build a small protoboard with a 16C84 and the stuff necessary to program it (the programming part is pretty easy). I then wrote software on the PC to burn it (though you could probably use someone else's I've always used my own). I highly recommend this approach, because it allows the PIC to be reprogrammed time after time without swapping chips, moving cables, UV erasing, or any of that nonsense. Just hit a key in my editor to save the file, run the assembler, and burn the chip. Or, when I was trying to interface it with some PC software (written in C), assemble the PIC code (if needed), compile the PC code (if needed), and finally run the PC code which would burn the chip (if needed) and then talk to it. > Any hoo, I was also > wondering, do all of the pics have a serial out command (like pbasic's > serout), because if I get the cheaper one, it will only program 18 pin > chips, which according to Digi-Key, none of them include these serial > features. I HAVE to have that feature. Digi-Key is real vague with some > of these things if you know what I mean. The 16F84 hardware consists of the following and essentially nothing else: - 1Kw of EEPROM code memory - 68 general-purpose registers (i.e. 68 bytes of RAM) - 64 bytes of data EEPROM (memory which holds its contents without power, and which may be written--albeit slowly--under software control). - An 8-bit counter/timer which simply counts 0-255 over and over again - An 18ms "watchdog" timer, independent of CPU clock speed, which will reset the chip if too much time elapses without the CPU executing a CLRWDT instruction. - An 8-bit "prescalar" which may be used EITHER to increase the watchdog time by any power of 2 from 1 to 128, OR to slow the timer down by any power of 2 from 2 to 256. - Twelve I/O pins which can be set individually to output a very strong "high" signal (20mA from VDD), an even stronger "low" signal (25mA to VSS), or no signal (i.e. they float); all 12 of these I/O pins have standard CMOS inputs. [Eight of these pins form "Port B"; the other 4 form part of "Port A"] - A thirteenth I/O pin which can't output a "high" signal but can either be floated or pulled low. This pin may safely handle voltages up to 14 volts. [This pin is the last pin on "Port A"] - Interrupt-control logic that can trigger an interrupt when bit 0 of PORTB changes, when any of bits 4-7 on PORTB change, or when the timer/counter module overflows. - Sleep logic that can wake the CPU when any of the interrupt-causing pins triggers an interrupt, when the watchdog times out, or when the chip is reset. [Note that the timer is stopped when the chip is put to sleep, so a timer interrupt cannot wake the CPU]. - Execution logic to handle the PIC's instruction set, along with the dedicated registers like W, STATUS, FSR, etc. Not a whole lot there; certainly no serial port. Do not despair, however: it's fairly easy to output data at 2400 baud via the following simple procedure: set the output low wait 416us [1/2400 second] set the output to the value of data bit 0 wait 416us set the output to the value of data bit 1 wait 416us ... set the output to the value of data bit 7 wait 416us set the output high wait at least 416us before setting output low again. The following simple procedure does the above: ; To output a byte of data, call this procedure with the data in OutVal. ; OutVal and C will be trashed; all other registers unaffected. ; Written from memory--untested OutByte: bcf PORTB,1 ; Assuming this is the output port bsf C OutLoop: call Delay410 ; Procedure to wait about 410us; must preserve ; all registers! rrf OutVal btfss C bcf PORTB,1 btfsc C bsf PORTB,1 bcf C movf OutVal,f ; Just test if it's zero; don't trash W btfss Z goto OutLoop ;call Delay410 ; See below return ; Once OutByte is called, the firmware must wait at least 416us becore ; calling it again. This may either be done by including the "call ; Delay410" indicated above, or by performing 410us or more worth of ; useful processing. Even though the PIC doesn't have a UART in hardware, the above code will allow serial data to be transmitted fairly easily. If it's necessary that data be sent or received while the PIC does other things (or sent and received simultaneously) then the code will need to run from an interrupt routine and will be more complicated; nonetheless, serial communications can be done quite adequately on a PIC despite the lack of specialized hardware. > Then once I get a programmer, > what pic should I use? I am somewhat attracted to the ones with the > A/D converters on them just because I use a lot of sensors in my > projects (I.E. hall effect transducers, mics, this neat-o thing > called a pulse amplifier, I rigged up one of the school's pH probe > to my calc set up, etc.). Well, as seasoned picers I'm sure you > might have a little advice and I would appreciate any of it. As I said above, I *really* like the 16C84/16F84, especially for beginning projects. Hopefully Microchip will be coming out with the other EEPROM-based parts sometime and you'll have a wider range of processors to choose from, but the 16C84/16F84 is really the way to go for a number of reasons: [1] Cheaper than windowed EEPROM parts; you can get started PIC'ing for less than $10, including the stuff you need for an in-circuit programming. [2] Impossible to destroy through errant programming. PICs are generally quite rugged devices (I've only destroyed two in application circuits: one had a port pin driven with raw rectified AC120 [the rest of the chip worked fine, but a 16C84 with a blown RB6 isn't too useful], and the other was accidentally powered off 8 volts [the odd thing about this one is that it *WORKED FINE* when I was feeding it 8 volts, but now it won't run with "only" 5]). However, glitches or mistakes in programming can easily destroy any of the OTP or window PICs. [3] In-circuit programming is *incredibly* convenient. Others may like different parts, but if you're looking to get started with PICs I'd say the 16F84 can't be beat.