programming help: part deux

Posted by Jon.

Engineer on team #190, Gompei, from Mass Academy of Math and Science and Worcester Polytechnic Institute.

Posted on 1/23/2000 1:44 AM MST

Does anyone know of a way to read only 1 input instead of all of them at once?
i need to sample a sensor a lot and don’t care for the rest…
thanks,
jon 190

Posted by Rick Berube.

Engineer on team #121, Rhode Warriors, from Middletown H.S…

Posted on 1/23/2000 9:03 AM MST

In Reply to: programming help: part deux posted by Jon on 1/23/2000 1:44 AM MST:

: Does anyone know of a way to read only 1 input instead of all of them at once?
: i need to sample a sensor a lot and don’t care for the rest…
: thanks,
: jon 190

Jon,
I don’t think you can read just a bit. The data you want is only accessible to your PBasic program via the SERIN statement. The Master CPU is the one that has access to that data. It reads all the sensor data on the RC and then serializes the data to the Stamp IISX. An interesting experiment however, would be to see how fast the Master CPU can update the data. We know that the interface supports at least a 40 Hz update rate based on the specifications. Can it go faster? Perhaps, but you may also read stale data (that is, the Master CPU may update that data at a lesser periodic rate than you are polling at).

You can certainly minimize the time for the SERIN statement by not reading as many bytes. According to my calculations, theorectically it takes ~160 uS to receive each byte (@ 62500 baud). Keep in mind however, that this one SERIN statement also brings in all your playerstation data, so there will be practical liimitations to what you can remove from the data stream. Also, I believe once the initialization section of code runs, the format of the data stream is etched in stone until the next reset of the RC.

Perhaps a call to Innovation First is on order ot answer this question.

Regards,

Rick

Posted by Eric Rasmussen.

Engineer from FIRST.

Posted on 1/23/2000 10:18 PM MST

In Reply to: Re: programming help: part deux posted by Rick Berube on 1/23/2000 9:03 AM MST:

: Also, I believe once the initialization section of code runs, the format of the data stream is etched in stone until the next reset of the RC.

You could always use the ‘robot reset’ button to remotely reset the PBASIC part, and that would cause the negotiation to happen again. However, that’s pretty ugly because: A) the driver would have to hit the button, and B) you would have to ‘remember’ what you wanted to renegotiate with either a sensor input or in the EEPROM, because the PBASIC RAM would be cleared when the processor was reset. (Everyone tells me, ‘Eric, EEPROMS have improved in recent years so now you get millions of write cycles’, but I still don’t believe they will last long if you write to the same address at 40 hz.)

-Eric

Posted by Nate Smith.

Other on team #66, GM Powertrain/Ypsilanti HS/Willow Run HS, from Eastern Michigan University and GM Powertrain.

Posted on 1/23/2000 11:31 AM MST

In Reply to: programming help: part deux posted by Jon on 1/23/2000 1:44 AM MST:

Jon,
You do only have one SERIN command to get all of your data from the RC’s main processor…but if it’s an analog input (sensor1-7 in the default control program), you can set the value in the DEFINE CONSTANTS FOR INITIALIZATION section of the control program for the one that you want to 1, and the rest to 0. However, if it’s a digital input(limit switch, etc.) that you want to read, you have to take the entire byte that the switch’s bit is stored in. Hope this helps…

Nate

Posted by Tony K.

Student on team #292, PantherTech, from Western High School and DaimlerChrysler.

Posted on 1/23/2000 2:14 PM MST

In Reply to: Analog or Digital? posted by Nate Smith on 1/23/2000 11:31 AM MST:

This SERIN thing has been tricky. Last year (as I found out…) you should NEVER modify the SERIN command. But this year it looks like you can add or subtract to it?!? Could you fill me in on this? Thanks!

TonyK

Posted by Nate Smith.

Other on team #66, GM Powertrain/Ypsilanti HS/Willow Run HS, from Eastern Michigan University and GM Powertrain.

Posted on 1/23/2000 4:03 PM MST

In Reply to: About that SERIN command posted by Tony K on 1/23/2000 2:14 PM MST:

: This SERIN thing has been tricky. Last year (as I found out…) you should NEVER modify the SERIN command. But this year it looks like you can add or subtract to it?!? Could you fill me in on this? Thanks!

: TonyK

This year’s SERIN can be modified to a point…the only restriction is that you can’t have more than 26 variables in it…and they have to be in a particular order, as outlined in the comments just before it. The DEFINE CONSTANTS FOR INITIALIZATION and PBASIC - MASTER uP INITIALIZATION ROUTINE are used to tell the master uP which of the 32 available pieces of data you want it to send back in the SERIN…

Nate

Posted by Jon.

Engineer on team #190, Gompei, from Mass Academy of Math and Science and Worcester Polytechnic Institute.

Posted on 1/24/2000 4:14 PM MST

In Reply to: programming help: part deux posted by Jon on 1/23/2000 1:44 AM MST:

thanks to all for the help - eom-