Thread: pBasic
View Single Post
  #3   Spotlight this post!  
Unread 24-06-2002, 00:16
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Re: pBasic

Posted by Lloyd Burns at 2/5/2001 2:16 AM EST


Other on team #188, Woburn Robotics, from Woburn Collegiate and Canada 3000, ScotiaBank, Royal Bank Financial.


In Reply to: pBasic
Posted by Robert Hennessy on 2/4/2001 10:59 PM EST:



: I am having great difficulty trying to understand the shiftin and shiftout functions. What is the cpin exactly? Is it user-defined or is there a specific pin that it must be defined as? Does it have to connect to a specific part of a sensor? Also, how do you access the robot interface internal clock? Thank you for any help in advance.

. SHIFTOUT/IN is not needed in the RC, as without tampering, you cannot access the pins on the pBasic interpreter. For other purposes, yes, you must designate a pin as cpin (as is done for fpin with the RC's SEROUT/IN commands).
. To access sensor number # (# = 1 to 7), change the value of the c_sensor# CON in the list from 0 to 1, and in the SERIN statement, in the appropriate place in the variables list, have a variable ready to receive the value.

. If you need timing, check the rate that the "basic run" LED on the RC is flashing: it should take about 80 ms to blink on then off, or, it should come on 125 times in 10 s. If this is the case with your final program, then each loop through your program takes 40 ms, since the LED is toggled (turns on if off, off if on) once per loop.
. The minimum loop time is determined by the OI, which sends a new package of data no more quickly than once every 40 ms. (The way to extend it is to write a complicated loop.) Every packet has a packet number (accessed as with sensor#, as explained above, by reading it), so if you note the packet number when you turn something on, and wait until the packet number is the same again, you will have to wait 256 * 40 = 10 240 ms or 10 and a quarter seconds. You can also subtract the old value from the new one to tell how many periods of 40 ms you have waited (if less than 10.24 s).
. The variable delta_t tells how long your loop is taking, but since the communications are generally good and the loop time in a particular program won't change unpredictably, forget delta_t, time your loop, and write the final program with that time value in mind.

Hope this helps



__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.