PDA

View Full Version : Life Testing Unit



turkeyus
05-09-2006, 02:11 AM
I am working on a project to test life cycle of a spa jet. I wrote the code with my entry level knowledge. Unfortunately I cannot compile. I attached the code and the schematics of what I am trying to accomplish. I need a help to check my code and suggestion on my circuit board - if there is any- such as if I need to use any resistors between the Solid State relays and BS2. If any body can help me I will greatly appreciate it.
Regards,

PJ Allen
05-09-2006, 04:06 AM
OK -- this program will require a lot of revision.

turkeyus
05-09-2006, 04:13 AM
That's encouraging:) What do you suggest?

PJ Allen
05-09-2006, 04:20 AM
· [At the beginning you need a PBASIC Directive.· The CONstants and VARiables aren't defined.· That's just for starts, basic stuff.]

· So -- How about a "flow chart"?

sam_sam_sam
05-09-2006, 04:58 AM
turkeyus

This is what JON's Example was to your post

http://forums.parallax.com/forums/default.aspx?f=5&m=123240

This is what PJ is talking about What is RED

' {$STAMP BS2}
' {$PBASIC 2.5}

secs VAR Byte
mins VAR Byte
tmr VAR Byte

Wait_Seconds:
FOR tmr = 1 TO secs
PAUSE 1000
NEXT
RETURN

Wait_Minutes:
FOR tmr = 1 TO mins
PAUSE 60000
NEXT
RETURN

'Now your main program can call either subroutine as needed.
'Let's say you wanted to delay for one hour, five minutes, ten seconds.
'You could now DO it like this:


mins = 65
GOSUB Wait_Minutes


secs = 10
GOSUB Wait_Seconds




Now i am at work and can not tell you if this works because i don not have my BS2 with
today

One thing i would ADD to what PJ Said is
You Need get the TIMER part of your CODE to WORK FRIST which is what i have here

While i can not try this CODE to see WHAT ELSE IT NEED...........
To MAKE it WORK ..............
IT will compile..............

You need READ WAM FRIST That will help you with what PJ was talking about and what
i put in RED


I hope this help you

Sam

Post Edited (sam_sam_sam) : 5/8/2006 10:53:40 PM GMT

turkeyus
05-09-2006, 06:46 AM
Thanks a lot guys!

First I modified my code based on what Sam showed. It was a good progress but the "cycle" on my code gave me an error: " Label is missing':' ." I realized I was making the same type of error which was I didn’t define "cycle" in PBASIC. Next, I defined cycle as a VARiable "cycle VAR Byte" and wolla!, it compiled. Now the question is I don’t know when it compiled it did what it suppose to do:) I can only be sure if I connect it to the circuit board but I am concern to burn BS2 and who knows what kind of suprises are waiting for me:). Any suggestion? Now I am gonna go head and create the flow chart for a better communication as PJ pointed.

PS.
Please advice where can I find and read and understand what WAM is as Sam suggested. I am not sure what READ WAM means. Is it a programming vocabulary as in ROM or an information you can read from a book?Regards,
Regards,

turkeyus
05-09-2006, 07:37 AM
I attached the Flow chart

Bruce Bates
05-09-2006, 07:49 AM
turkeyus -

"WAM" is just forum shorthamd (unfortunately) for the fine Parallax Educational Text (and Kit) called "What's A Microcontroller" (ergo W-A-M). You can find that text here, free for the download:
http://www.parallax.com/detail.asp?product_id=28152

It's VERY informative and educational, and geared toward the "newly inititated" http://forums.parallax.com/images/smilies/smile.gif
Please enjoy it, along with all the other fine Educational Texts Parallax offers.

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->

Post Edited (Bruce Bates) : 5/9/2006 1:49:01 AM GMT

turkeyus
05-09-2006, 09:00 AM
I completed the flow chart and attached in my previous post. Downloaded WAM and going to read every page of it tonight. In the mean time if any of you can take a look at my code and give me any suggestion/correction regarding to my code and circuit diagram I will appreciate it.
Regards,
Utku

Jon Williams
05-09-2006, 09:12 AM
It is a bit messy and I don't understand how you're driving relays. Why two pins? I could probably rewrite your program is just a few minutes if I knew what you wanted it to do (i.e., write out the sequence as a list of steps, not code).

I've attached what I think is a "pro" version of your program.· For what I consider "pro" techniques you might want to download and read· StampWorks after you've finished WAM.· WAM + StampWorks will put you in great shape to take these kinds of projects.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

Post Edited (Jon Williams (Parallax)) : 5/9/2006 3:17:11 AM GMT

turkeyus
05-09-2006, 03:18 PM
You right; my relay control is little confusing. All I was trying to do using 24vdc to turn on 230VAC 3-phase pump motor starter. I connect 1pin to “+” and Vss to “-“.
All I want to do is:

Run the re-circulation pump to fill the tanks and keep them cool-it takes ~10 min to fill, but continues run
Run the 3 pumps for 60 min
Stop the 3 pumps for 10 sec
Repeat this 23 times~1 day
‘At the end of the day, empty out the tanks to the reservoir”
Turn off all the pumps
Turn on all the valves-takes 1min fully open
Wait 10 min to emty out the tanks to the reservoir
Turn off all the valves-takes 1 min fully closed
Turn on the heater to dry out the jets in the tank-takes 20 min to dry.
Repeat from the beginning.

I read your “pro” version and obviously I didn’t understand many part of it since I am an entry-level programmer. My constrain here is the time since my two bosses are on top of me. I will be happy to use your “pro” version WHILE I am improving my programming skills to write my own. However, I am concern that if I need to change any numbers such as repetition time or amount of minutes it takes to empty out the tanks, the changes may cause the programming to fail. The program I was trying to write might be too amateurish but it is very simple, I can understand, and wrong:). That being said, if you can “rewrite my program in just a few minutes” I would love to continue in this journey with your edition.

And the most important! thanks a lot for all the help you are providing.!
Regards,
Utku

Post Edited (turkeyus) : 5/9/2006 8:22:35 AM GMT

Jon Williams
05-10-2006, 01:04 AM
Here's the thing -- that program should have made MORE sense to you because it is written in a very verbose style. Again, if you're new, don't punish yourself with a difficult first project; work through WAM? and have a look at StampWorks too. It won't take long to come up to speed and you'll be writing programs very much like the one I posted. The important aspects of this style is that it is self-documenting, and easy to update and maintain.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

turkeyus
05-12-2006, 06:41 AM
Jon,
I am studying WMA. In the mean time I tried your code but it didn’t work; only my pump2 relay LED was blinking. Hopefully I will be able to figure it out soon; before I got fired:)
Regards,
Utku

Jon Williams
05-12-2006, 09:54 AM
Well, right code that works first -- if your job is in jeopardy; then focus on learning to write code that's easy to maintain and update. The problem is, once most people get something working they want to wash their hands of it and move on to something else....

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax