reading the I2C and then putting the data into variables takes enough
time that you won't see any particular speed improvement by trying to
make them an oCompare VC.
DLC
Shaggy wrote:
> I'm running into an issue where I might run out of object memory, so I have
> to choose what to build as a virtual circuit, and what I should just leave
> in code. I have two motors that run based on a countdown timer. I set the
> value of the countdown object, and the motors run until the countdown
> reaches 0. There are also 24 touch switches. My intention is that if one of
> the switches is triggered, the countdown value is set to 0, thereby
> switching off the motors immediately. I was figuring that this "reflex"
> should be among the fastest things to happen, so I thought I might create a
> VC for the switches. However, the switches are read from an I2C object, and
> those can't be included in a VC directly. Therefore, I thought I would read
> the three banks of switches into three bytes (I have to do this anyways,
> because I need the bytes). Then the VC would use three oCompare0 objects to
> check whether any of the bytes are above 0. An oGate3 object will OR the
> three oCompare0.Above properties and trigger an oEvent based on whether the
> oGate3 results in True or False.
>
> However, the event triggered by the oEvent clears the counters, and sends
> some information out the serial port. None of that is VC, but it has to
> happen. It would be a bit more difficult to try to put the clearing of the
> countdown timer into the VC, and I'm already pushing the limit of the object
> memory, so I didn't seriously consider doing it.
>
> My problem is that even this VC is gobbling up about 20 bytes, or about 25%
> of the object memory, which appears to be acceptable, though only marginally
> so. I don't have the event quite working yet (v B2.2+, so I don't have the C
> oEvent bug), but I'm uncertain whether it's even worth doing. Considering
> that reading the I2C into the three bytes is not part of the VC, and that
> the event itself, where the countdown is cleared (in certain situations
> only, so there are two if statements prior to the clearing of the value), is
> not part of the VC, will I actually see much of a speed boost versus the
> single line:
>
> if alert1 > 0 or alert2 > 0 or alert3 > 0
>
> which is all I am really replacing with the three oCompare objects and the
> oEvent.
>
--
------------------------------------------------------
Dennis Clark ooPIC Tech Support
www.oopic.com
------------------------------------------------------
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment