|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Master uP Initialization Routine
What's all of this:
tempA CON c_p3_x <<1 + c_p4_x <<1 + c_p1_x <<1 + c_p2_x <<1 + c_rc_swB dataInitA CON tempA <<1 + c_rc_swA <<1 + c_oi_swB <<1 + c_oi_swA tempB CON c_sensor4 <<1 + c_sensor3 <<1 + c_p1_y <<1 + c_p2_y <<1 + c_sensor2 dataInitB CON tempB <<1 + c_sensor1 <<1 + c_packet_num <<1 + c_PB_mode tempC CON c_batt_volt <<1 + c_sensor7 <<1 + c_p1_wheel <<1 + c_p2_wheel <<1 + c_sensor6 dataInitC CON tempC <<1 + c_sensor5 <<1 + c_p3_y <<1 + c_p4_y tempD CON c_res01 <<1 + c_delta_t <<1 + c_p3_aux <<1 + c_p4_aux <<1 + c_p1_aux dataInitD CON tempD <<1 + c_p2_aux <<1 + c_p3_wheel <<1 + c_p4_wheel Output COMA low COMA low COMB Wait_init: if IN3 = 1 then Wait_init: Shiftout COMB,COMA,1, [dataInitA,dataInitB,dataInitC,dataInitD,dataInitVo lt] Input COMA high COMB Does it actually effect the I/O processor? Let's say I keep all the c_constants 0... does it make a difference? Does it have an effect on the order of variables that the SERIN command takes? |
|
#2
|
|||||
|
|||||
|
As far as I know the order of the variables is set no matter if you change the c_CONstants to 1 or 0. If you have selected a variable to be a CON 0 then that variable in the serin command is skipped over (you omit it completely). I wouldn't change the code that you pasted in your message.
|
|
#3
|
|||
|
|||
|
It's just combining the variables in your program to 4 large variables so it can send it faster over the modem. There's no need to modify it that I can think of.
|
|
#4
|
||||
|
||||
|
EEK!
If you look at the diagram in the innovation FIRST controller manual, there is a block diagram somewhere in the front that shows there are three processors in the RC. The Main processor, the Basic stamp you program, and a slave output processor. The code you're looking at instructs the Basic Stamp HOW to communicate with the main processor. It would be a serious mistake to change that code! But it makes for interesting reading.
Best Wishes Steve Alaniz "What good is technology if you can't abuse it?" - Ted Forth |
|
#5
|
|||||
|
|||||
|
The STAMP2/SX processor within the robot controller does not have the variable space to retrieve every possible input value for your program to use. Therefore, the block of code you mentioned is required to tell the Master CPU which variables you want sent to your code in the SERIN command. To do this, set the corresponding constant for each value you want to use in the "Define Constants for Initialization" section to 1. Note, as it has been previously mentioned, the order these variables arrive is FIXED(see the comments above serin in the default code), but the constants determine which of the possible variables you will recieve.
General rule for looking at the default code: If it says "do not change", DON'T |
|
#6
|
||||||
|
||||||
|
Order what you want, eat what you order...
I agree with Steve and Nate. I have this to add, though.
Basically you have a menu to pick from by setting the c_variablename constanst to 1 or 0. Once you pick from the menu, your choices get sent to the kitchen via the shiftout command you are asking about. It is your job to make sure you order what you wanted because that is what the master CPU is going to send you 40 times a second for the rest of your life (or until you reprogram your STAMP2). As to your particular question, all those lines of code are turning your menu choices into the right string to output via the shiftout command. Basically, by shifting left and adding in new constants that are either 1 or 0, you are building up a constant that has 1's and 0's in the right place for the shiftout command. If you are a coding "tough guy" you can set the bits directly by just assigning dataInitA etc. to something in one step (e.g. dataInitA=$F8). While it is possible to do this, it is silly and very likely to cause you grief. In the end, the best thing is to use the code as Innovation First intended. Joe J. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| initialization program and speed controllers | rosebud | Programming | 15 | 05-10-2004 03:35 |
| Image Discuss: Stack Master | CD47-Bot | Robot Showcase | 13 | 04-03-2003 21:47 |
| Team 1002: Master Strategy | Real Deal | Robot Showcase | 3 | 25-02-2003 08:48 |
| my master plan (mwahahahahaha) | archiver | 2001 | 4 | 23-06-2002 22:04 |
| Pre-Match/Post- Match Pit Routine | Mark_lyons | General Forum | 14 | 31-03-2002 15:19 |