Stamp vs PIC microcomputers

Electronics Computer Programming Q&A
Rodney
Posts: 162
Joined: Sat Aug 31, 2002 1:01 am
Location: Titusville, FL USA
Contact:

Stamp vs PIC microcomputers

Post by Rodney »

I want to get my feet wet with either the Stamp or PIC microprocessors. I'm a retired EE and did some programing on the old 286 and also S100 bus but have been dormant for the last 15 years. Which is the better choice, Stamp or PIC? What is the minimum expenditure to get a good start? I want to do some experimenting with batteries on logging charge, discharge times, etc. and later have the data available to graph out on a computer.
hlreed
Posts: 349
Joined: Wed Jan 09, 2002 1:01 am
Location: Richmond, TX
Contact:

Re: Stamp vs PIC microcomputers

Post by hlreed »

Rodney,
Jump right into the PIC. PIC assembler is simpler than BASIC and you do not waste all that real estate with interpreter code.
Buy the PIC Start Plus programmer setup from DigiKey $199. That gives you some programming books and a sample 16F84 which is all you will need to get started and there is nothing else to buy except chips.
Harold L. Reed
Microbes got brains
desterline
Posts: 86
Joined: Mon Jun 09, 2003 1:01 am
Contact:

Re: Stamp vs PIC microcomputers

Post by desterline »

Woha!!<p>Assembler simpler than Basic, I have to disagree.<p>But to answer Rodney's question, if all you want to do is to monitor some battery charge / discharge curves, I'd avoid the issue completly and buy a ready made data aqusition device.<p>I have a DI-194 from www.dataq.com the're less than $25 and happily sample up to 240 samples sec (4 channels) at 8 bit resolution. The included software is very powerfull and capable of displaying the data in an oscilloscope like display or exporting the data into common file formats. There are also programming examples to collect the data right into Excel.<p>If you realy want to get into microcontrolers, I'd reccomend skipping basic stamps and going right into PICs.
Basic stamps are nice and simple, and you can get a starter kit for $100-$200 depending on which one you pick. But sooner or later your going to want to do a project that needs more than one, then the difference between a $50 stamp and a $5 PIC is going to make you sick. ;-)<p>As to costs:
A basic programmer can be bought for less than $15 (PIC-PG2C from Olimex)
Toss in resonator for less than $1 and a couple PICs $1-8$ depending on model<p>Asuming you have a breadboard and power supply you could be into it for less than $30.
If you don't have a breadboard, etc. another $100 will add a nice breadboard, power supply, an LCD, buttons, resitors, capacitors, etc.<p>On the software side, the stamp software is free, but there are free tools for PICs as well (check out JAL). But I use and reccomend picBasic Pro from MeLabs combined with microCode Studio. Granted I've spent $250-$300 in software, but I think it's worth it.
If you want to try before you buy, both of them have downloadable versions. The compiler demo is limmited to 31 instructions, but you can do a lot with that! (I interfaced a sony playstation controler and an LCD with 28 instructions!)<p>Hope this helps!
Denny Esterline
Rodney
Posts: 162
Joined: Sat Aug 31, 2002 1:01 am
Location: Titusville, FL USA
Contact:

Re: Stamp vs PIC microcomputers

Post by Rodney »

Thanks to both of you gentlemen, you have varified what I was thinking. My only problem is that now, in my searching on the web, there are a few other microprocessors out there such as the Atom. anyone have any experience with them?
desterline
Posts: 86
Joined: Mon Jun 09, 2003 1:01 am
Contact:

Re: Stamp vs PIC microcomputers

Post by desterline »

Well, there's several stamp "clones", but in my (limited) experiance they all have the same fundemental features and drawbacks, that is:
They provide an easy to use simplified enviroment to use the proccessor, but in simplifying they prevent access to some of the more powerful features of the proccessor. (this is a huge gneralization with many exceptions, please don't flame me over it)<p>If you do choose a 'module' over a PIC, I would reccomend the Basic Stamp, for one simple reason:<p>Support.<p>The've sold millions of the little buggers, it's been a hobbiest mainstay for the better part of a decade, if you have a problem, need advice, want a project idea, or anything else there are thousands of people who can help. That is less so with the newwer competitors.<p>
That's true of PICs as well, just look a www.piclist.com It's a e-mail list over two-thousand members strong! <p>Good luck!
Denny
ralcocer
Posts: 1
Joined: Tue Aug 19, 2003 1:01 am
Contact:

Re: Stamp vs PIC microcomputers

Post by ralcocer »

I am new to microcontrollers also coming for the old z80 days , I started with the AVR 8515 because I got a hold of a AVR board used to hack satellites bur it has a programmer built in 4, 8 bit ports, Analog comparator UART , timers and a lot of other thing , I also found a basic interpreter yhat I can load into memory and input the code and run it from my terminal, The assember looks like basic.<p>Anybody ever heard about this.
Tommy volts
Posts: 149
Joined: Tue Oct 29, 2002 1:01 am
Location: Arizona
Contact:

Re: Stamp vs PIC microcomputers

Post by Tommy volts »

Rodney,<p>You can get a PIC kit which includes the programmer, assembler, the PIC, sample codes, and literature at Carl's Electronics for $17. I built the kit in 30 minutes and within a few hours I learned assembly language for the chip (the one Harold mentioned) and wrote my first program. I downloaded MPLAB for free and I use it now to help edit my code. My first application was simply clicking a relay but it worked great.<p>You can't go wrong with this investment and all that you learn is transferable to any system you finally choose.
Rodney
Posts: 162
Joined: Sat Aug 31, 2002 1:01 am
Location: Titusville, FL USA
Contact:

Re: Stamp vs PIC microcomputers

Post by Rodney »

Tommy, where is Carl's Electronics please? Do they have a web site? Thanks rod
Tommy volts
Posts: 149
Joined: Tue Oct 29, 2002 1:01 am
Location: Arizona
Contact:

Re: Stamp vs PIC microcomputers

Post by Tommy volts »

rodney,<p>Here is a link to the kit.<p>
PIC Kit
desterline
Posts: 86
Joined: Mon Jun 09, 2003 1:01 am
Contact:

Re: Stamp vs PIC microcomputers

Post by desterline »

Well, It's a place to get your feet wet, but I wouldn't reccomend it. <p>According to the web site: <p>"Software is only for the 16C84 & 16F84 so no other programming options to confuse you"<p>The problem with that is the 16F84 has been superceeded by THREE generations (16F84A, i6F628 and very recently the 16F648) and the 16C84 is even older. Microchip has moved the 16F84A to the "Mature Products" section of the line card. (in case you don't know, "Mature Products" is basicly a synonym for "Don't use for new designs")<p>If you just want an inexpensive programer, Olimex offers a PIC-PG2C for less than $15 that will program all the newer parts.<p>-Denny
chessman
Posts: 292
Joined: Tue Jan 14, 2003 1:01 am
Location: Issaquah, WA
Contact:

Re: Stamp vs PIC microcomputers

Post by chessman »

I started in PIC programming almost a year ago. It seems funky at first, especially if you've never written code in assembler before.<p>With the STAMP, there are commands that make up several lines of assembler. The stamp is much easier if you've used a program such as BASIC before.<p>In short, I've used both the PICMicro and the BASIC Stamp. I prefer the PICs much better, since they are far superior in terms of memory, clock speed, and versitility. Yes, they're harder to program. It's a trade off, and the choice all depends on what you want out of your choice of controller.
ElectronicBrains
Posts: 2
Joined: Wed Sep 17, 2003 1:01 am
Location: North Carolina
Contact:

Re: Stamp vs PIC microcomputers

Post by ElectronicBrains »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Rodney:
I want to get my feet wet with either the Stamp or PIC microprocessors. I'm a retired EE and did some programing on the old 286 and also S100 bus but have been dormant for the last 15 years. Which is the better choice, Stamp or PIC? What is the minimum expenditure to get a good start? I want to do some experimenting with batteries on logging charge, discharge times, etc. and later have the data available to graph out on a computer.<hr></blockquote><p>Writing in PIC assembly is always going to require the minimum expenditure (moneywise). The tools are cheap (or free) and you can program the chip without any BASIC overhead. You don't have to buy someone else's hardware modules or sub-assemblies. <p>However, you need to consider development time and the complexity of what you'd like to accomplish. My personal choice is to develop in C. The CCS compiler is one of the best for the serious hobbyist. CCS includes device drivers and built-in functions that make it a breeze to interface with LCDs, EEPROMS, Real Time Clock chips, Dallas iButtons, X-10, RS-232 and SPI just to name a few. The command line version of the compiler is affordable ($125 list) and it is compatible with MPLAB. Add the In-Circuit Debugger for $75 and you are ready to go.<p>My experience has been this: Writing in C allows you to think more about WHAT you want to do, rather than HOW to do it. Yes, you can say the same about Stamps, but you are still stuck buying their modules. C offers a very good compromise between cost and development time. It is a very natural language that looks worse than it really is. If you are intimidated by the thought of learning C, consider taking an Introduction to C Programming class at your local community college. If you already know ANSI C, then you are set. Want to write to an LCD? Use the good old printf() function!<p>Joe<p>[ September 17, 2003: Message edited by: ElectronicBrains ]</p>
A bad day programming is better than a good day of just about anything else.
bodgy
Posts: 1044
Joined: Tue Dec 04, 2001 1:01 am
Location: Australia
Contact:

Re: Stamp vs PIC microcomputers

Post by bodgy »

I do most of my Pic programming in 'C' and some in Basic. However there are times when the need to understand assembler is useful and even very important.<p>1. There will come a time when you will need to write some code in assembler for various reasons.<p>2. ALL cross compilers use up overhead and have to make guesses on how to compile the source code into assembler (even if they by pass this and produce a hex file only).<p>It can be useful to understand why your program has either become much bigger than you thought it should or sometimes why the code doesn't act the way you thought it should.<p>The dearer the cross compiler the better it is at producing tight code. Compilers that use linkers are better than those that don't.<p>As an example of what I mean, I use a linking C compiler from Forest Electronics, now this example shows how ASM is needed to keep the code tight and a strange failure of the compiler when it comes to some 'C' statements. Bear in mind that this is just a proof of concept program and so while it works, it has not been tidied.<p>void main();<p>unsigned char sec,min;<p>void main()
{
while(1)
{
//counting decimal 0-> 100 in BCD
#asm
plus:
incf sec
movlw 6
addwf sec,w
btfss STATUS,DC
goto plus
movwf sec
xorlw 0xA0
btfss STATUS,Z
goto plus
fin clrf sec
#asmend ;SO FAR SO GOOD
min++; //min same as sec routine
min+6;//This puts min into W-reg
if(STATUS&=(1<<DC)) This line causes this to be assembled as
min=min;
}
}
NOW THIS IS TOTAL CODSWALLOP! Coded in assembler it would be
BTFSS STATUS,DC ;But because of the way the assembler operates in this particular instance it goes a loooooong way to get the same result. If you don't understand basic assembler you wouldn't spot the compiler bug and work your way around it.
;~ Line : 00026 if(STATUS&=(1<<DC))
00026
00026 movlw 3;
00026 movwf FSR
00026 bcf STATUS,IRP
00026 movlw 2
00026 andwf 0
00026 movfw 3
00026
00026 iorlw 0
00026 SETPCLATH L000009,main,0
00026 skpnz
00026 goto L000009
00026 SETPCLATH main,L000009,0
00026 L000011:
00026
00027 ;~ Line : 00027 min=min;
00027
00027 movfw min
00027
00027 mo<p>
Colin<p>[ September 18, 2003: Message edited by: bodgy ]</p>
On a clear disk you can seek forever.
ElectronicBrains
Posts: 2
Joined: Wed Sep 17, 2003 1:01 am
Location: North Carolina
Contact:

Re: Stamp vs PIC microcomputers

Post by ElectronicBrains »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by bodgy:
void main();<p>unsigned char sec,min;<p>void main()
{
while(1)
{
//counting decimal 0-> 100 in BCD
#asm
plus:
incf sec
movlw 6
addwf sec,w
btfss STATUS,DC
goto plus
movwf sec
xorlw 0xA0
btfss STATUS,Z
goto plus
fin clrf sec
#asmend ;SO FAR SO GOOD
min++; //min same as sec routine
min+6;//This puts min into W-reg
if(STATUS&=(1<<DC)) This line causes this to be assembled as
min=min;
}
}
<hr></blockquote><p>Colin, <p>I agree with some of what you say (compilers with linkers are generally more efficient). I used the Hi-Tech compiler at a previous job. It is a fine product from Australia that produces very tight code. However, it cost over $800 and is therefore out of range of most hobbyists. Also, it had none of the device drivers for X-10, RTC chips, external EEPROMs and Dallas iButtons (ALL of which were being used on the product I was developing). It was also time consuming to get this compiler up and running.<p>But I need to point out a few things about your source code: If you are wanting to check the state of the Digit Carry bit, the proper C statement should be:<p>if(STATUS & DC) or if(STATUS & (1<<DC)), depending on whether DC is defined as the Digit Carry bit value or bit position. <p>Your use of the "&=" operator is incorrect in my judgment. That is not a bitwise operator..."a &= b" is the same as "a = a & b". To test a bit in C, you must use the bitwise "&" operator (without the "="). Your code is modifying the STATUS register, rather than testing it. You are ANDing it with (1<<DC), and probably clearing some important bits. I really don't see why you would ever have the need to even look at the STATUS register when writing in C. I suspect your BCD routine can be better handled in C, rather than dropping to assembly. This would remove the need for looking at the STATUS reg altogether. If you are trying to squeeze every last byte and bit out of your micro, then C is not the language you should be using. Stick with assembly.<p>Also, your statement "min+6;//This puts min into W-reg" has me mystified. I don't think that is a valid C statement to begin with (my CCS compiler simply ignored it), and certainly don't see how it is putting min into the W reg. Actually, you should never mess with the W reg from within the C environment. It can cause your code to exhibit lots of strange behavior. Within a #ASM block, it is okay, but not from a C statement.<p>A C programmer should think in C and let go of assembly as much as possible. The whole point of C is to insulate oneself from the low-level hardware. Yes, by all means go back and look at the listing. And yes, embedded C will always require an awareness of the hardware being used. Just don't try to "micro-manage" the compiler.

Joe<p>[ September 18, 2003: Message edited by: ElectronicBrains ]</p>
A bad day programming is better than a good day of just about anything else.
bodgy
Posts: 1044
Joined: Tue Dec 04, 2001 1:01 am
Location: Australia
Contact:

Re: Stamp vs PIC microcomputers

Post by bodgy »

You is right !<p>My error with the &= which would also explain the strange ASM. In fact it was only after my mentioning it on the support forum for the compiler that it was pointed out to me my typing error. One of those where no matter how many times you look at it the mistake doesn't show up!<p>min+6 is not valid ANSI 'C', but of course for Pics and most microcontrollers they do not use true 'C', and with the Wiz-C compiler it is the only way that I have found to leave a result in 'W' without it using the compilers inbuilt software stack or double handling of registers. <p>Colin<p>As an afterthought: The reason the code was in ASM was partly because of all the extra runtime bits and pieces Wiz-c bungs in -(it clears all variables, allocates stack and SP variables plus some extra housekeeping stuff) I wanted to see which function used the least amount of words. This was to be part of a program that was to be coerced into a 628 and the program words of the complete program in 'C' I might add came to 1998 - so not much room left. ASM is a legitimate way to try and squeeze it all in. <p>I take your point about a 'C' programmers program in 'C' and ASMers in ASM, however there are times like Bitbanging where ASM is going to be better than 'C' it unless using one of those really expensive 'C' programmers that cost $8K or more.<p>For the 18F series I only really use 'C' or Basic, but the 16 series I find mix and matching to be benificial, just have to make sure that the linker and compiler don;t try to optimise the ASM functions.<p>Wiz-C has built in libraries for 1W and from v10 at the end of the month will have graphics LCD cabablity as well as converter functions from Hitech and CCS programs.<p>[ September 18, 2003: Message edited by: bodgy ]</p>
On a clear disk you can seek forever.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests