Shop OBEX P1 Docs P2 Docs Learn Events
Life Testing Unit — Parallax Forums

Life Testing Unit

turkeyusturkeyus Posts: 8
edited 2006-05-12 02:54 in BASIC Stamp
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,

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-05-08 21:06
    OK -- this program will require a lot of revision.
  • turkeyusturkeyus Posts: 8
    edited 2006-05-08 21:13
    That's encouraging[noparse]:)[/noparse] What do you suggest?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-05-08 21:20
    · [noparse][[/noparse]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_samsam_sam_sam Posts: 2,286
    edited 2006-05-08 21:58
    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
  • turkeyusturkeyus Posts: 8
    edited 2006-05-08 23:46
    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[noparse]:)[/noparse] 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[noparse]:)[/noparse]. 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,
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-05-09 00:49
    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" 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
  • turkeyusturkeyus Posts: 8
    edited 2006-05-09 02:00
    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 WilliamsJon Williams Posts: 6,491
    edited 2006-05-09 02:12
    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
  • turkeyusturkeyus Posts: 8
    edited 2006-05-09 08:18
    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[noparse]:)[/noparse]. 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 WilliamsJon Williams Posts: 6,491
    edited 2006-05-09 18:04
    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
  • turkeyusturkeyus Posts: 8
    edited 2006-05-11 23:41
    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[noparse]:)[/noparse]
    Regards,
    Utku
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-12 02:54
    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
Sign In or Register to comment.