?
Solved

BASIC STAMP : How to input bits into an accumilator

Posted on 2005-03-26
3
Medium Priority
?
271 Views
Last Modified: 2011-10-03
Lets say I have two push button switches connected to the input port of a basic stamp. What I want to know is how to write a simple program to input a "1" when the 1st button is press and a "0" when the sexond button is pressed. I'll have the the 5v connected to both switches and a not gate connected to the second.
0
Comment
Question by:940775
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Expert Comment

by:LRHGuy
ID: 13637893
If I understand the problem, you want to use ONE input port, which to the stamp is either a 1 or a 0, and connect two buttons to it to detect either a 1 or a 0 .... it doesn't seem possible.

You'd need a tri-state input for that...which would be "seen" as a 1 a 0 or "not a 1 or 0" as the third state. I don't believe the stamp can do that.

Now it you're using two input ports, no problem!
0
 

Author Comment

by:940775
ID: 13638033
OK LRHGuy, lets use two input ports. How would you write the code  (just an example)?
0
 
LVL 7

Accepted Solution

by:
LRHGuy earned 1000 total points
ID: 13638325
With the stamp it's a simple process:

KEEPGOING:
 IF PIN1=1 THEN DOONE
 IF PIN2=0 THEN DOTWO
 GOTO KEEPGOING

DOONE:
  ; handle button
  GOTO KEEPGOING

DOTWO
  ; handle button
  GOTO KEEPGOING

Put whatever you need to do in the DOONE/DOTWO sections.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn how to use the free Acronis True Image app to easily transfer data between iPhones and Android phones.
Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question