Go to Post If everyone spent half as much time reading and understanding the rules as they do complaining, arguing, and disagreeing about rules, we might not even be having this discussion. - AmyPrib [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #16   Spotlight this post!  
Unread 12-08-2003, 21:46
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
The BS2sx program goes through some housekeeping: after the directives to the compiler, variables are declared, and typed (p1_x VAR byte, for example). Some bytes are reserved for the transmitted data, and for the local on-robot stuff, as both OI stuff and the RC input stuff are not "read" directly by the 'computing process', but are passed to it from the input process via the SERIN statement.

Think of the CPU as three functions ; input, 'computing', and output.

When you get to the "set the initiallization constants" section, you are preparing to tell the input organizer which bytes to send. As they tell you in the default program, you cannot accept all the bytes the input section has and can send you; you must select a subset to be sent.

You set the constant for a particular byte you want, and then, in the MASTER uP INIT'N section of the default, tempA = (the constant for p3_x shift left once + the constant for p4_x) shift left + the next yada yada ... shifts the first 5 bits into tempA.

dataInitA shifts the 5 bits collected in tempA, along with 3 more, to give eight bits.

Eventually you have 4 bytes of dataInit, A,B,C, and D and then after declaring you want to send it, you wait until the input process is ready to receive, the shift it out. OUTPUT COMA sets the COMA pin to output, LOW sets it to 0 V, INPUT puts the pin into input mode. Lows on COMA and COMB are a signal to the input process. You don't send right away, but you wait, until IN3 goes low, which is the signal the input process is ready to hear from you.

Once that's sent, you get into the main loop, and there the serin command expects to hear as many bytes as you requested, sent in the order IFI has arranged for in their machine code, in the input process, and in the which order you have written your serin (as they cautioned you to do). If you didn't make the c_whatever CON equal 1, it won't be sent; if you don't have it in the correct order (IFI's), your right front wheel might well be executing the commands for your battle-arm. If you don't have the correct number of bytes in the SERIN, you'll see BASIC INIT ERROR.

Think of the input process looking at the 4 bytes, bit by bit, as it sends out data - "is this one that i send ? , if so I will, if not I'll test the next bit, and if it's set, I'll send that". Each bit corresponds to a byte it can send to the computing process

Clearer ?
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Battlebots I.Q.- A serious threat to FIRST or a half thought up cheep copy? Joe Matt General Forum 75 17-10-2005 20:43
switch speed control wayne 05 Programming 6 01-10-2003 09:35
A DEAD reckoning program rcubes85 Programming 5 19-03-2003 14:21
last years speed controllers..... archiver 2001 9 23-06-2002 23:44
Speed Controllers archiver 2000 1 23-06-2002 23:01


All times are GMT -5. The time now is 09:01.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi