Shop OBEX P1 Docs P2 Docs Learn Events
Binary Operators — Parallax Forums

Binary Operators

dbjdbj Posts: 75
edited 2008-12-25 04:09 in General Discussion
Trying to write in code that controls waste oil heater, I am using a DS2760 thermocouple and a SX28 that , what I would like to do Is set a output high and then turn it off and stop the program when the temp gets over 140 C degrees . The SX dose not have a Binary operator > greater than which is what I have used in the past with basic Stamp. If I use the code in the SXB editor it runs but wont work. Shutdown is a Sub that turns off the pin that drives a AC relay. Thanks David


Basic code that works ======== IF tempF > 340 THEN LOW OT1

SXB code ================ IF tempC => 140 GOTO Shutdown

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-12-24 01:16
    IF tempC >= 140 THEN GOTO Shutdown
  • JonnyMacJonnyMac Posts: 9,214
    edited 2008-12-24 02:16
    If SHUTDOWN is a subroutine you should call it like this:

    IF tempC >= 140 THEN
      SHUTDOWN
    ENDIF
    


    The reason is that IF-THEN implies a GOTO (compiles to JMP @Label), not GOSUB (compiles to CALL @Label).
  • dbjdbj Posts: 75
    edited 2008-12-24 08:18
    In over my head!! Trying to use SX28 to control Waste oil heater using DS2760 as mention before , I am trying to use code that was wrote for reading and displaying the temp on one wire LCD. I dont know is I need to store the value then read it or if I can just use what the LCD is using?? Thanks for any help , Sorry for hacking up your code Terry I had a working BS2P24 control for over two years The stamp went Bad and cant afford to get new one Just got laid off from work. Thanks David
  • BeanBean Posts: 8,129
    edited 2008-12-24 13:07
    David,
    · The technical term is is "borrowing" code [noparse];)[/noparse]
    · I'm not sure what you are trying to do in the "Control" routine ??? Exactly what do you want to happen at what temperatures ???

    · You can·use the "temperature" variable, just make sure you do it BEFORE the LCD routine. Because the LCD routine destroys the value in "temperature".

    · Also, the value in "temperature" is in 0.1'C units. So 140'C will be the value 1400 (NOT 140). This may be what was causing you grief.

    ' Calculate temperature from thermocouple ADC voltage
    temperature = ADCtoTempC adc
     
     
    ' Put your code here, remember that "temperature is in 0.1'C units. So 100.0'C will be 1000
     
    If temperature > 1400 Then ' 1400 = 140.0'C
      Shutdown
    EndIf
     
     
    ' Display temperature on LCD
    LCDSend BackliteOn
    LCDSend CLS
    
    


    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ·The next time you need a hero don't look up in the sky...Look in the mirror.




    Post Edited (Bean (Hitt Consulting)) : 12/24/2008 1:57:44 PM GMT
  • dbjdbj Posts: 75
    edited 2008-12-24 19:20
    Hey Bean Thanks for the help I am still having problems with this code, what I am trying to do is make a safety shut off that monitors the temp of the heat exchanger on a waste oil heater for my home. What I want is to use a DS2760 with the probe tip inserted into the heat exchanger and control a single pin so that I can drive a solid state relay that will control a master shut off relay to kill the power on the burner. Thus shutting down the heater in case of a malfunction. I did this with a BS24p as I said before. I have tried to strip down the code and eliminate the LCD part of the program so that it would not cause problems, I also have tried the code that JonnMac suggested and have placed it almost everywhere I can Think. Still cant make it work, seems that tis SX stuff if real hard to grasp. Thanks David Here is the latest Attempt
  • dbjdbj Posts: 75
    edited 2008-12-24 19:42
    Sorry I posted the wrong File in the last Post here is the most recent Blunder!!
  • BeanBean Posts: 8,129
    edited 2008-12-24 22:21
    David,
    Please post the BS24p code.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ·The next time you need a hero don't look up in the sky...Look in the mirror.


    ·
  • dbjdbj Posts: 75
    edited 2008-12-25 04:09
    Thanks For your help Bean, I got it to work just as you said, Have a Merry Christmas and a wonderful New Year!!
Sign In or Register to comment.