Need a couple easy tips from the gurus!
These should be easy but I do have a couple questions (I'm just starting to program with my bs2).· I am using a gps for input and an·LCD for output.· My questions have to do with hardware connections.
1)· I first connected my GPS transmit and ground pins to input pin 0 on the bs2 and ground respectively.· Then PBasic couldn't find my BS2!· Then I connected the GPS ground through a resistor to ground.· Can someone explain why this works and not before?
2)· Say I want to do the simple LED flash program - I connect the cathode of the LED to P0 and also the cathode through a resistor to ground.· The anode of the cathode is connected to P1.· The PBasic program then puts P0 high and low to turn on and off the LED.· What does the connection to P1 have to do with it?
3)· Any other connecting tips I can find useful?· It is hard to find documentation about actually connecting it and what the resistors inbetween are doing etc..
thanks!
1)· I first connected my GPS transmit and ground pins to input pin 0 on the bs2 and ground respectively.· Then PBasic couldn't find my BS2!· Then I connected the GPS ground through a resistor to ground.· Can someone explain why this works and not before?
2)· Say I want to do the simple LED flash program - I connect the cathode of the LED to P0 and also the cathode through a resistor to ground.· The anode of the cathode is connected to P1.· The PBasic program then puts P0 high and low to turn on and off the LED.· What does the connection to P1 have to do with it?
3)· Any other connecting tips I can find useful?· It is hard to find documentation about actually connecting it and what the resistors inbetween are doing etc..
thanks!
Comments
·· There are a few things unclear about your post.· My guess on the GPS is that when you're connecting it you've previously had the I/O pin set to an output and there is contention between the GPS and the BASIC Stamp.· This is just a guess based on later statements you made.
·· Speaking of which, you said something about the anode of the cathode, but they are two different leads.· A cathode of a component should be more toward the Vss side of the circuit and the anode should be more toward the Vdd side.· The exception being when a diode is used for protection purposes.· Could you please clarify your connections?
·· It's always a good idea to clear out the previous program before wiring up new hardware.· This is easily done by downloading a program that contains nothing more than an END statement.· This ensures that you don't have pins conflicting when you power up the BASIC Stamp.· I hope this helps.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
1) FIrstly I connected the GPS transmit wire to the P0 input and the GPS ground to the bs2 ground.· The bs2 still powered up but when I tried to run the program, PBAsic couldn't find my bs2.· It would only find it when I unplugged the GPS ground pin.· So I knew there must have been some conflict.· So I ended up resolving the problem by·connecting the GPS ground pin through a resistor to the BS2 ground.· I was wondering why the resistor placement fixed the problem.
2) I meant the "anode of the LED connected to P1"·not "the anode of the cathode connected to P1" sorry.· My question is what P1 pin's·purpose was in the circuit.· I assume that the circuit is complete by connecting the anode to P1 because P1 is by default 0 Volts.· But I'm not sure.
· Again, on both questions I still don't know what the previous state of the pins was.· Did you clear your program before connecting everything up and powering up the BASIC Stamp?· As for the resistor, if there was a short, it would reduce the amount of current being drawn from the BASIC Stamp, possible allowing it to program.· As for the LED, are you using a series resistor on it?· It should not be connected to the I/O pins without one.· The P1, if not initilialized should be in a high-impedence state.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
as for the LED question, the circuit would look like this:
······· r
P0--\/\/\
gnd
············· |
········ ···· |
P1--|<----
······ LED
and I was wondering the purpose of P1 but I think you answered my question in saying that to complete the circuit, you need to use the 5V at P1.
Now, you also said:
>>>>As for the LED, are you using a series resistor on it?· It should not be connected to the I/O pins without one.
Can you explain why it needs that resistor.· Maybe in general, what is the purpose of resistors in between things connected to inputs and outputs?
thanks very much by the way.· I appreciate your help.
·
·· That circuit is not the correct way to connect an LED to I/O pins.· There are example circuits and an explanation of the need for the resistor in the "What's A Microcontroller?" tutorial, a free download from our website in PDF format.
http://www.parallax.com/detail.asp?product_id=28152
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Please take a moment off things and read "What's A Microcontroller?" , even if you just read parts of it I'm sure you will find a lots of tips for your BS2 projects.
For more documentation just take a look around Parallax web site , they have tons of documentations and everything is made in a very explanatory way.
I'm absutely sure you will find your answears there.
Amaral.