Putting robotics at your service™

Free shipping on orders over $200

Basic stamp 2 programing

Print view Share :
Previous topicNext topic

Page 1 of 2 [ 23 posts ]

1, 2
Rookie ( offline )
Posts: 11
Posted: 2007-09-08 19:15 
 Post subject: Basic stamp 2 programing
can somebody help me write the program for the following:

In order to measure variable quantities, the BASIC Stamp utilizes the software command
RCTime. RCTime relies on the charge/discharge behavior of a resistor-capacitor pair to indicate
the relative value of the variable quantity. In most of our applications, a fixed capacitor is used
with a variable resistance device. Many electrical sensors/transducers change resistance in
response to an external stimulus. You will be introduced to these types of devices which include
thermistors, RTD's (resistive temperature device), strain gages, and photocells in future
experiments. Alternately, if there was a variable capacitance (a humidity sensor is an example)
device used to sense a quantity, a fixed resistor would be utilized to produce a decay rate that
would be compatible with the BASIC Stamp.
Experiment 1b: Identify and select the Cadmium-Sulfide (CdS) photocell. The specifications
indicate that the dark resistance is approximately 20 MW, while the light resistance is less than
1kW. Use a 1 KW resistor and a 1.0 μF capacitor along with the photocell. Note, the capacitors
that you have in your kit are either disc or tantalum capacitors. Their capacitance is written on
the body of the device. They should have either a 104 or 105 marked on the units. The 104
stands for 10 X 104 picofarads or 0.1 μF. Please refer to the RCTIME command reference to
calculate values of R and C for other applications. Using the RCTime and DEBUG commands,
write a short program to read the output from the photocell and then output the value to the
debug screen to read. Once the program is running, cover the photocell with your hand and note
the change in the display value. If necessary, modify the program so that lower numbers are
displayed under dark conditions and higher numbers under light conditions. Please note that the
display will be in integers only, ranging from 0 to 65535. The RCTime variable should be in the
range from 5,000 to 65,000. Adjust the component values to bring the variable value into
specification.


if you can, please help me

hcein


Guru ( offline )
Posts: 2251
Posted: 2007-09-08 19:55 
Sounds like homework (fall classes have started). If it is homework, you are probably paying an instructor good $$$ to explain these things to you, so ask the instructor first to get some of your investment back. Also, the "Use a 1 KW resistor...) indicates someone probably didn't proof read their instructions. If it isn't homework, then what have you tried so far to solve the problem?


User avatar
Guru ( offline )
Posts: 3578
Posted: 2007-09-08 20:19 
Do you have a stamp board? Per the instructions, it sounds like you were given parts to perform this assignment. Like zoomcat said, get your moneys worth and ask the teacher to explain any grey areas and at the very least try it your self.

_________________
Mike

The robotics nut.


Rookie ( offline )
Posts: 11
Posted: 2007-09-09 00:04 
of course it's homework; if i were able to do it i wouldn't search for help over the internet guys!!! and i asked the teacher and what he explained didn't really make sense so i had no choice to try here since nobody wants to have a zero on an assignment, i had to ask for help before givin up,

I've been trying this homework for 2 weeks now


Guru ( offline )
Posts: 2251
Posted: 2007-09-09 01:33 
So post up some of the code or info on what you have been trying for two weeks that isn't working. You will probably need to demonstrate that you have been making some effort yourself to resolve the issue before people will spend their effort to figure it out for you.


User avatar
Guru ( offline )
Posts: 3578
Posted: 2007-09-09 08:52 
Not to be rude but two weeks of research on the internet would have explained enough about the subject so that you would be able to understand. There are examples all over the place and all you would need to do is try one example and see for your self how it works.

You never even answered my question: Do you even have a stamp board?

I don't think anyone on this forum is going to do the work for you without some evidence that you at least tried to learn this on your own.

_________________
Mike

The robotics nut.


Rookie ( offline )
Posts: 11
Posted: 2007-09-09 16:31 
here's what i did:

CdS CON 0

light VAR Word
Loop:
LOW CdS
PAUSE 1
RCTIME CdS,0,light
DEBUG Home,DEC5 light,CR
PAUSE 100
GOTO Loop

When i cover the CDS cell with my finger, the output is still the same, it doesn't detect when i cover it.


Rookie ( offline )
Posts: 11
Posted: 2007-09-09 16:42 
yes i have a stamp board; and i don't really want you to do the homework for me, all i am asking is some help. i should have posted the work i did since the begining, you're right, i just wanna know if somethig is wrong with what i programmed so far coz it ain't workin


Rookie ( offline )
Posts: 11
Posted: 2007-09-09 17:19 
hello i figured out my problem

CdS CON 0

light VAR Word
DO
LOW CdS
PAUSE 1
RCTIME CdS,0,light
DEBUG Home,DEC5 light,CR
PAUSE 100
Loop

this works, when i run it it gives me a big value, and when i cover the photocell it returns 0. that works.

and thanks for trying to help me


User avatar
Guru ( offline )
Posts: 3578
Posted: 2007-09-09 17:35 
hcein wrote:
hello i figured out my problem

CdS CON 0

light VAR Word
DO
LOW CdS
PAUSE 1
RCTIME CdS,0,light
DEBUG Home,DEC5 light,CR
PAUSE 100
Loop

this works, when i run it it gives me a big value, and when i cover the photocell it returns 0. that works.

and thanks for trying to help me


Glad you figured it out! You learned more by figuring out what you did wrong on your own than if we just pointed it out. If you go to the Parallax website, they have tons of information about this sort of stuff for the future.

I have to give you a lot of credit for figuring it out because this stuff aint easy when you don't know whats going on in the beginning. We have all been there before. Quick advice for the future; if you post as much information upfront, such as your current code, results, problems and even a link to a photo, members would help as much as they can.

here's a link to Parallax.com a great place for tons of information:

www.parallax.com

Here is a link to another site that explains more about this topic:

http://www.utc.edu/Faculty/Tatiana-Allen/rctime.html

_________________
Mike

The robotics nut.


Last edited by SN96 on 2007-09-09 17:41, edited 1 time in total.

Rookie ( offline )
Posts: 11
Posted: 2007-09-09 17:37 
thanks a lot man


User avatar
Guru ( offline )
Posts: 3578
Posted: 2007-09-09 17:47 
Here is another simple program that displays the results to the debug window:

Code:
result  VAR     Word

Test:
  HIGH 7                                ' charge the cap
  PAUSE 1                               '   for 1 ms
  RCTIME 7, 1, result                   ' measure RC discharge time
  DEBUG DEC ? result                    ' display result
  END



I got this right out of the Stamp program software also known as the IDE (interface development environment).

When you are in the Stamp IDE, press F1 and a help file will open you can do a search for "RC Time" and that is how I found this example code.

_________________
Mike

The robotics nut.


Rookie ( offline )
Posts: 11
Posted: 2007-09-09 17:52 
yeah i got that one too;

thanks for the help


User avatar
Guru ( offline )
Posts: 3578
Posted: 2007-09-09 17:53 
And here is the example that they gave in the same help topic:


_________________
Mike

The robotics nut.


Rookie ( offline )
Posts: 11
Posted: 2007-09-09 18:32 
yeah got that too am using this program

CdS CON 0
light VAR Word
DO
LOW CdS
PAUSE 1
RCTIME CdS,0,light
DEBUG HOME,DEC5 light,CR
PAUSE 100
LOOP

when i run it it returns 0 under light and when i cover the cell with my hand the value increases.

my problem now is how to make it do the contrary: i mean:

how to make it return 0 under dark and high number under light


1, 2

All times are UTC - 5 hours [ DST ]. It is currently 2014-12-21 17:31
Feedback Form
Feedback Form