This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Sunday, December 2, 2007

[oopic] Re: Weird Program Behavior

Good question. I have no idea. I guess it never occurred to me that
I could w/ oopic, but I don't know what I was thinking. I will
definitely use variables here on out.

@Richard: Makes sense-I should be using variables anyway. Thanks.

--- In oopic@yahoogroups.com, Andrew Porrett <slicerwizard@...> wrote:
>
> Why are you using so many objects instead of variables?
>
> At 03:18 PM 12/2/2007, turgrid wrote:
> >oDIO1 IO1 = New oDIO1;
> >oDIO1 IO2 = New oDIO1;
> >oDIO1 IO3 = New oDIO1;
> >
> >oWire IOWIRE = New oWire;
> >oWire startInputWIRE = New oWire;
> >
> >oDIO1 startInput = New oDIO1;
> >
> >oSerialX lcd = New oSerialX;
> >
> >oWord cvStepSize = New oWord(9975);
> >oWord cvStepAdjuster = New oWord(5013);
> >oWord cvSteps = New oWord;
> >
> >oWord distance = New oWord;
> >
> >Void Main(Void){
> > Delay = 1000;
> > oBit adv = New oBit;
> >
> > lcd.IOLineS = 16;
> > lcd.Baud = cv9600;
> > lcd.Operate = 1;
> > lcd.String = "?f";
> > lcd.String = "?3"
> > lcd.String = "Advanced Config"
> > lcd.String = "??"
> >
> > IO1.IOLine = 5;
> > IO2.IOLine = 6;
> > IO3.IOLine = 7;
> >
> > IO1.Direction = cvOutput;
> > IO2.Direction = cvInput;
> > IO3.Direction = cvInput;
> >
> > Do {
> > If(IO3.State == cvTrue)
> > adv = 1;
> > } While (adv == 0 And IO2.State == cvFalse);
> > Do{
> > }While (IO2.State == cvTrue);
> > lcd.String = "?f"
> > lcd.String = "Enter Distance: "
> > lcd.String = ">";
> >
> > oByte count = New oByte;
> > distance = 0;
> >
> > For (Byte x = 100; x > 0; x = x/10) {
> > count = 0;
> > Do {
> > If (IO3.State == cvTrue) {
> > Do {
> > } While (IO3.State == cvTrue);
> > count++;
> > }
> > } While (IO2.State == cvFalse);
> > Do{
> > }While (IO2.State == cvTrue);
> > distance = distance + count * x;
> > }
> >
> > lcd.String = "?f";
> > lcd.String = "Distance: ";
> > lcd.String = Str$(distance);
> >
> > lcd.String = "Steps: "; // PRINTING DISTANCE HERE WORKS
> > calculateSteps; // I DO NOT KNOW WHAT HAPPENS HERE
> > lcd.String = Str$(cvSteps); // NOT PRINTING
> >}
> >
> >Void calculateSteps(Void) {
> > oWord word1 = New oWord;
> > oWord word2 = New oWord;
> > word1 = (distance - 500) * 100; // PRINTING OUT word1
HERE RETURNS
> >0 FOR UNKNOWN REASON
> > word2 = (word1 Mod cvStepSize) / 10;
> > word1 = word1/cvStepSize; // NOT SURE IT EVER EVEN
EXECUTES THIS
> >AREA OF CODE
> > cvSteps = word1 * 1000;
> > cvSteps = cvSteps + word2 + cvStepAdjuster;
> >}
>



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:

http://docs.yahoo.com/info/terms/

No comments: