Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

BASIC Stamp: Which one to get?

Status
Not open for further replies.

coastergeekrtc

New Member
I'm looking at using a BASIC Stamp to run a motor system in which switches, acting as sensors, switches, and relays wil be used. The cheapest model is the BSC1-IC but Parallax recommends beginners use the BSC2-IC. Now I was looking at the different types of BSC2 and was thinking of getting the BSC2e-IC. Is that over kill for my project? Basically, I want to press a button, the motor runs fast in a forward position, stops, reverses slowly, and stops at the beginning. The switches used as sensors will detect the system at certain points and those will switch the motor to different states.

Also, where can I go to understand how to write PBASIC source code?
 
coastergeekrtc said:
I'm looking at using a BASIC Stamp to run a motor system in which switches, acting as sensors, switches, and relays wil be used. The cheapest model is the BSC1-IC but Parallax recommends beginners use the BSC2-IC. Now I was looking at the different types of BSC2 and was thinking of getting the BSC2e-IC. Is that over kill for my project? Basically, I want to press a button, the motor runs fast in a forward position, stops, reverses slowly, and stops at the beginning. The switches used as sensors will detect the system at certain points and those will switch the motor to different states.

Also, where can I go to understand how to write PBASIC source code?

The BASIC STAMP is a very expensive solution, far cheaper to just use a normal PIC and assembler, which is fairly easy to learn.

Or, if you really want to use BASIC?, a PICAXE chip is extremely cheap, and would probably do all you need.
 
I was reading in the sticky topic about PICs and was wondering if you recommend the In Circuit Debugger 2 as the programmer? And once the PIC is programmed, do I just take it off the programmer and add it to my circuit or does it always have to stay on the programmer? Also, I have never tried programming before and want to make everything easy on myself, should I learn Assembly or Basic? Will the recommended 16F628A work for what I need to do?
 
coastergeekrtc said:
I was reading in the sticky topic about PICs and was wondering if you recommend the In Circuit Debugger 2 as the programmer? And once the PIC is programmed, do I just take it off the programmer and add it to my circuit or does it always have to stay on the programmer? Also, I have never tried programming before and want to make everything easy on myself, should I learn Assembly or Basic? Will the recommended 16F628A work for what I need to do?

You should always learn assembler, you can't use a PIC effectively with BASIC or C without at least a reasonable knowledge of assembler.

The 16F628A would be fine for you requirements.

The ICD2 would be fine as a programmer, you can program the chip then move it to your circuit, or program it in-circuit (if you design it acordingly).
 
Newcomers said:
4. Which Programming language to choose?
a) If you are starting with PICs, I strongly recomend learning Asembly first. Most programs on Internet are written in it. Also keep in mind that Asembly is code compact and fast. Microchips Aplication Notes are also written in it.
b) If you know Asembly well, You might try C based programming languages. C will simplify your program (but will take more resources). Many complex projects are made in C (mostly 18F based, but also available for 12F/16F).
c) Or try Basic, If you know PC BASIC this is really simmilar: **broken link removed**

Assembly is really important, learning it should be anybody's first step in learning ANY MCU!
 
coastergeekrtc said:
I was reading in the sticky topic about PICs and was wondering if you recommend the In Circuit Debugger 2 as the programmer?

Yes and no. Yes if you're going to pay cash for the ICD2.

I would recommend it as your second advanced programmer because it is not easy to get it going in the first time or until you have a good knowledge about PIC in general. There are a thousand ways that the ICD2 clone will not work the first time and you must then know where to troubleshoot.

You should try to build a more general programmer first(which also help you to program the bootloader into the ICD2 clone) before the ICD2 clone can function.

My suggestion is the P16Pro40 programmer which you can obtain details from Nigel's PIC website under his forum signature. I have built three already and they all worked perfectly.
 
Thank you for all this help...but I have just a few more. I want to run two switches that will act as sensors. But I only wan't one to have power supplied to it at a time. Also, I want the PIC to sense that the switch was turned on and then use that information to switch a relay. Basically I want it to sense a connection when the switch is momentarlily pressed and then released. It can be programed to turn off one switch when the other is on and use their very momentary ON states to trigger a relay and hold it in that position, right?
 
Nigel Goodwin said:
THREE! - are you greedy? 8)

One for myself and one I gave to my friend to tempt him into using PICs. It achieved both its intended purposes.

The third one was the one I built on a breadboard in an attempt to check the claim on 12V Vpp programming voltage and 100cm connecting cable length.
 
Warp13 programmer from Newfound Electronics is nice.

In response to your question, the chip is programmed and is then removed from the programmer. Or, in many cases, the chip is set up so it can be programmed by the programmer without even removing it from the circuit (used all the time for SMD parts). It uses 2 wires for data, 1 for providing the programming voltage to Vpp, one for ground, and one for +5v (which may not be needed if the circuit is powered by other means.
 
Without programming knowledge, I would like to ask a few more questions.
If I set Pin1 to output at high(+5V) and Pin2 to input and connect the two with a switch, can I program the PIC to sense the connection of the switch, then it turns the output to the other sensor switch to high, turns Pin1 to low (to shut itself off) and switches a relay to reverse the motor? And if the launch button is momentary, can I have it hooked up the same way (input to output and it turns itself off) but I have to hold it down for 2 seconds to activate a series of LEDs and launch the train (the LEDs will be for a small dragster tree that counts down to the launch)? And when a pin is set to an output of high, what is this doing? Is it just sending a current and voltage through and into the connected component? Like if I hook a relay to an output pin, where does the other connection out of the relay go? To a ground? One more question...what would you suggest I use to learn Assembly? A book or a website? Thank you for your previous help.
 
Sorry for the double post but I found a website that has free books online about programing and PIC Microcontrollers. One of these books is dedicated to writing a Basic program for PICs, but it says that Basic is slower than Assembly when the program executes. How much slower usually? I understand the Basic more than Assembly and would use it if its not extremely slow.
 
Yes, programs written in Basic will be slower (and bigger) than Assembly. My estimation is something about 2~3times slower (depending on functions needed). It's because when you code in Assembly, you know what you need and what you don't, whereas in Basic case, this job is handled by the Compliler, which has no clue what you really want (it makes sure everything is nice and pretty).


PS: next time you ask something, break your questions into more, smaller posts asked one at a time...
 
coastergeekrtc said:
Without programming knowledge, I would like to ask a few more questions.
If I set Pin1 to output at high(+5V) and Pin2 to input and connect the two with a switch, can I program the PIC to sense the connection of the switch, then it turns the output to the other sensor switch to high, turns Pin1 to low (to shut itself off) and switches a relay to reverse the motor? And if the launch button is momentary, can I have it hooked up the same way (input to output and it turns itself off) but I have to hold it down for 2 seconds to activate a series of LEDs and launch the train (the LEDs will be for a small dragster tree that counts down to the launch)? And when a pin is set to an output of high, what is this doing? Is it just sending a current and voltage through and into the connected component? Like if I hook a relay to an output pin, where does the other connection out of the relay go? To a ground?

Normally you'd use a 1k-10k resistor between +5v and a switch which grounds the signal. So the circuit draws no current when the switch is off and 5mA-0.5mA when on. If this isn't a momentary pushbutton and that's too much current to leave on, you can supply the resistor with a pin that can be switched from 5V to 0V. Of course the switch must be powered before you can read it and it may not catch transitions right away.

Yes like any electrical circuit, a relay must make a complete circuit. 5v on one side and ground on another.

For a relay, the PIC may not be able to safely supply enough current, you'll need an extra transistor.

For LEDs, you must ALWAYS have a current limiting resistor in series with the LED.

Don't forget about C. Very effective language, I highly recommend it.

Just how much bigger and slower BASIC or C compiled code is than assembly depends partly on the quality of the compiler and a whole lot on the quality of the code. It's easy to write things like floating point math in that may seem logical but is extremely cumbersome for the compiler to implement in assembly. Well written C code is not much bigger or slower than assembly. It can even be faster than poorly written assembly, but that's a bit of an unfair comparison since the person who doesn't understand assembly probably won't know how to write efficient C code either.
 
Ok, so I'm guessing that Assembly is the best way to go for a beginer like me. i am using this online book to learn the language and the PIC...hopefully I will undertand after reading. **broken link removed**
 
coastergeekrtc said:
Ok, so I'm guessing that Assembly is the best way to go for a beginer like me. i am using this online book to learn the language and the PIC...hopefully I will undertand after reading. **broken link removed**

Yes, that's fine, but see my tutorials as well - you should bear in mind that the 16C84 and 16F84 are long obselete, they were replaced by the cheaper 16F628 last century! - all of these use the same 14 bit core.

As for the speed of BASIC, it really depends what you are doing, but compiled BASIC is pretty fast - the BASIC STAMP however is EXTREMELY slow (in PIC terms). As the STAMP is an interpreter (and not a compiler) it mostly runs hundreds of times slower than assembler - but the high speed of a PIC means this is more than enough for many purposes.
 
Ok, I'm absolutely sticking with a PIC microcontroller. And according to your site the 16F628 doesn't need an oscillator since it has one built in. Does it also have a reset button, or do I need to make that as well.
 
coastergeekrtc said:
Ok, I'm absolutely sticking with a PIC microcontroller. And according to your site the 16F628 doesn't need an oscillator since it has one built in. Does it also have a reset button, or do I need to make that as well.

Why do you want a reset button?.

The 16F628 has the capability of having one, but you can set the confguration fuses and reassign the reset pin as an I/O pin - this allows you to have 16 I/O pins an an 18 pin chip - the 16F84 only has 13 I/O pins. Notice that in both cases, some pins have restrictions on their use - you need to check the datasheet.
 
coastergeekrtc said:
I thought you had to have one, but I guess not. And I will go check the datasheet.

No, it will reset as you apply the power, none of my tutorial boards have reset buttons - it's a waste of an I/O pin, and the 16F628 allows you to reallocate it.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top