Shop OBEX P1 Docs P2 Docs Learn Events
How to look up specified data in a Basic Stamp?? — Parallax Forums

How to look up specified data in a Basic Stamp??

Turnbull2112Turnbull2112 Posts: 65
edited 2011-01-02 15:00 in BASIC Stamp
Lets say I have two RCTIME values I'm reading with a BS2. I would like to return specific data to use as an alarm point based on the two readings. Just as an example if RCT1 = 1000 and RCT2 = 500 then give me "X" value. This would follow a curve or a profile that I am going to build based on how the RCTIME values follow my process. Does anyone out there understand what I'm getting at? I'm not sure if there is a formula for a curve that would work or a string of pre-defined data points that the BS2 could follow. Help?? Thanks,

Comments

  • ercoerco Posts: 20,256
    edited 2010-12-27 11:38
    You are free to manipulate those RCtime values in any number of mathematical equations and branch using if-then checks. Alternatively, you can use curve fitting (sample techniques online) or make a lookup table to get your X on.
  • Spiral_72Spiral_72 Posts: 791
    edited 2010-12-27 11:42
    I read your post a couple times and I'm not sure I completely understand, however:

    Arrays can be defined in a BS for data points by "RCval1(n) VAR Byte" where "n" is the size of the array, as in numbers of items. Byte could be Word or Nib depending on the size of the data entry.

    Else, if this is a linear relationship, you could use the ol' Y = M*X + B formula. Non-linear relationships are difficult to find a formula for although I do remember generating a non-linear curve based on data points. Google should help you there, although it can become very complex depending........

    I'm assuming you expect the BS to read two RC values and perform some calculation to activate an alarm for an external process. I guess what we need to know is; What is the relationship between RCT1 & RCT2??
  • stamptrolstamptrol Posts: 1,731
    edited 2010-12-27 16:16
    You can also use the LOOKUP and LOOKDOWN instructions to easily create a custom fitted curve. See the Help file in the Stamp programming software.
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-12-31 07:31
    If you don't expect too many data points you can curve a bunch of IF THEN EQUALS statements into a formula or the range you want. You can therefore log these points into the eeprom and later read out as data for plotting and conditioning. You could also use the Parallax data logger for lots of data points.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2011-01-02 15:00
    I would like to return specific data to use as an alarm point based on the two readings. Just as an example if RCT1 = 1000 and RCT2 = 500 then give me "X" value. This would follow a curve or a profile that I am going to build based on how the RCTIME values follow my process. ,

    Please explain in more detail what you are tring to do Thanks
Sign In or Register to comment.