Go to Post If full body suits can be made to fit properly, why do we have so many robots with saggy bumper covers? - GaryVoshol [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-02-2007, 08:42
Metalgod4eva Metalgod4eva is offline
Registered User
None #0870
 
Join Date: Jan 2007
Location: Southold
Posts: 7
Metalgod4eva is an unknown quantity at this point
Robot style EOF?

What is the terminating character in the robots stream? System its EOF or '\0'. Another question if a stream > BUFFER will it allocate memory for the '\0' and place it? Also what lib's are not supported? One last question does constants in C like BUFFER, NULL, and FILE?
  #2   Spotlight this post!  
Unread 05-02-2007, 09:37
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: Robot style EOF?

Yes, \0 is terminating character for "strings" (character arrays).
  #3   Spotlight this post!  
Unread 05-02-2007, 09:44
esquared's Avatar
esquared esquared is offline
Keeps saying 3-2-1-Rush...
AKA: Angry Eric
no team (Volunteer!)
Team Role: Mascot
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Boston, MA
Posts: 192
esquared has a reputation beyond reputeesquared has a reputation beyond reputeesquared has a reputation beyond reputeesquared has a reputation beyond reputeesquared has a reputation beyond reputeesquared has a reputation beyond reputeesquared has a reputation beyond reputeesquared has a reputation beyond reputeesquared has a reputation beyond reputeesquared has a reputation beyond reputeesquared has a reputation beyond repute
Re: Robot style EOF?

You will find programming for the Robot Controller in a microcontroller environment much different than programming for a PC.

To answer your questions about various library functions that are supported, please go to Microchip's page and look at their C Compiler User's Guide.
  #4   Spotlight this post!  
Unread 05-02-2007, 10:25
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Robot style EOF?

There are no streams. There are no files. "EOF" is not a valid concept on the Robot Controller.
  #5   Spotlight this post!  
Unread 05-02-2007, 16:33
Metalgod4eva Metalgod4eva is offline
Registered User
None #0870
 
Join Date: Jan 2007
Location: Southold
Posts: 7
Metalgod4eva is an unknown quantity at this point
Re: Robot style EOF?

does anyone have some form of proof of this no such thing as a data stream on the robot, because the pwm passes chars to the engine and one would think that in theory that alone is a data stream and without EOF issues in ending the stream would have an issue.
MPLAB: The MPLAB® C18 compiler is a full-featured ANSI compliant C compiler for the PIC18 family of PICmicro® 8-bit MCUs. MPLAB C18 is a 32-bit Windows® console application as well as a fully integrated component of Microchip’s MPLAB Integrated Development
Supports ANSI so then it must use things like EOF, enum, etc all of which people have said is not complient with the robot.
  #6   Spotlight this post!  
Unread 05-02-2007, 20:22
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Robot style EOF?

Quote:
Originally Posted by Metalgod4eva View Post
...the pwm passes chars to the engine...
I have no idea what you mean by this. PWM stands for Pulse Width Modulation and refers to the signalling used to command servo position and the Victor speed controller outputs. It also gets used to refer to the three-wire cables and connectors that carry those signals, and by extension to similar cabling and connectors used to carry other signals.

The only thing I can think of that might be called an engine is one of the motors, but they certainly don't accept data of any sort.

What do you mean by "pwm" and "engine"? For that matter, what do you mean by "EOF"?



The MPLAB C18 compiler manual details a number of ways in which the ANSI C '89 standard is not followed. So far as I can tell, however, enumeration types are supported.
  #7   Spotlight this post!  
Unread 05-02-2007, 23:46
kitscuzz's Avatar
kitscuzz kitscuzz is offline
Not alotta posts
AKA: Kit
FRC #1389 (Worst Case Scenario)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Home
Posts: 47
kitscuzz will become famous soon enough
Re: Robot style EOF?

Kevin tends to use chars as another form of integers. Chars are, in fact, simply numbers, 8 bits in length that happen to be interpreted differently when sent to a terminal. There is not an "End Of File" command because you never send strings except to the camera, and then you really only send the characters and the line in terminated by a \r or \n, and wait for the camera to reply appropriately.

The processor interprets the data based on the information given to it by the code, aka if you pass a character, the processor waits for 8 bits of data, there is no need to indicate the "EOF" of a character because the processor knows that there is only 8 bits, no more, no less.

The "End Of File" command is actually an antiquated way of identifying the end of files in old DOS operating systems. The "EOF" command is no longer used except as a method of terminating input at a terminal (and even then, it's rare because the EOF command varies based on the operating system, not the hardware), and for saving files for VERY old systems. It is also occasionally used as indicating the end of a file when being sent over the internet (look into netcat 1.0).

The reason most systems don't use the EOF anymore is because they simply identify the size of the file at the start of the data, and then the computer doesn't need to read the whole file in order to allocate an appropriate amount of memory to display the file.

Last edited by kitscuzz : 05-02-2007 at 23:50.
  #8   Spotlight this post!  
Unread 06-02-2007, 09:06
Metalgod4eva Metalgod4eva is offline
Registered User
None #0870
 
Join Date: Jan 2007
Location: Southold
Posts: 7
Metalgod4eva is an unknown quantity at this point
Re: Robot style EOF?

Quote:
Originally Posted by kitscuzz View Post
Kevin tends to use chars as another form of integers. Chars are, in fact, simply numbers, 8 bits in length that happen to be interpreted differently when sent to a terminal. There is not an "End Of File" command because you never send strings except to the camera, and then you really only send the characters and the line in terminated by a \r or \n, and wait for the camera to reply appropriately.

The processor interprets the data based on the information given to it by the code, aka if you pass a character, the processor waits for 8 bits of data, there is no need to indicate the "EOF" of a character because the processor knows that there is only 8 bits, no more, no less.

The "End Of File" command is actually an antiquated way of identifying the end of files in old DOS operating systems. The "EOF" command is no longer used except as a method of terminating input at a terminal (and even then, it's rare because the EOF command varies based on the operating system, not the hardware), and for saving files for VERY old systems. It is also occasionally used as indicating the end of a file when being sent over the internet (look into netcat 1.0).

The reason most systems don't use the EOF anymore is because they simply identify the size of the file at the start of the data, and then the computer doesn't need to read the whole file in order to allocate an appropriate amount of memory to display the file.
Actually EOF does not identify the size of the file or the start of data. EOF stands for End Of File/stream and job to signal like a semicolon in C statements, that the particular data stream is finished. EOF is represented as -1 or '\o'. As a native C programmer I have never heard anyone ever mention that EOF was no longer a macro in the standard lib anymore ^ have I seen it even not been. I understand that when working with robot on partial C code that does not conform to ANSI or hides most the code in many files that you just assume that if you don’t run across EOF does not mean its not there. EOF is a macro and is used for every line of stream. AKA after every \n a -1 is placed. Think of it as more of an End OF line. http://www.cprogramming.com/faq/cgi-...wer=1048865140
In response to kitscuzz:
Char are 1 byte and 3 byte padding:
"EOF" is not a character, its -1 an int:
Name an OS does not use EOF:
When passing a string to a cam: A string is an array, there is no string support in C. So all chars are saved in ordnance of the 0th element to MAX-1 element, The MAX element is '\0' || NULL in a char array and '-1’ in and int array. /*Lets for argument sake allow NULL == EOF even though there different in the char array the eof follows null*/ That is also the reason Even if you never declared the array all the function for strings must use them, thus all strings use EOF, all arrays use EOF. Brain W. Kernighan and Dennis M. Ritchie creators of c have an ANSI Book read pages 17, 28, chapter 7 151, 242+. Have a great day!
  #9   Spotlight this post!  
Unread 06-02-2007, 09:45
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Robot style EOF?

Quote:
Originally Posted by Metalgod4eva View Post
...EOF stands for End Of File/stream and job to signal like a semicolon in C statements, that the particular data stream is finished...
I'm still confused. What do you mean by "stream"? I understand it as a C++ or Java concept for dealing with reading and writing strings. Regular ANSI C doesn't have it. MicroChip C certainly does not.

Quote:
In response to kitscuzz:
Char are 1 byte and 3 byte padding:
This is absolutely incorrect. In MicroChip C (and EasyC), a char holds an eight-bit value. One byte. No padding.

Last edited by Alan Anderson : 06-02-2007 at 10:23. Reason: explicit context to make buddy.smith happy
  #10   Spotlight this post!  
Unread 06-02-2007, 09:54
buddy.smith buddy.smith is offline
Master Control
FRC #1795
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: atlanta
Posts: 20
buddy.smith is an unknown quantity at this point
Re: Robot style EOF?

Okay, to be pedantic:

A char is NOT 8 bits. A char is 8 bits on some (probably most) platforms, but it is not required.

Here are the requirements for data types in C:
A char is some size.
A short is at least as big as a char.
An int is at least as big as a short.
A long is at least as big as an int.

If you say 'a char is 8 bits', please quantify that by saying 'a char is 8 bits on the PIC, and the x86 as well'. Some DSPs have 16 or even 24 bit chars!

As far as EOF, I think we need to figure out what question the original poster really meant to ask. What are you trying to accomplish, that you were thinking you needed to use EOF for?

If it's for reading data from the serial, you use '\n' (or '\r', or both). Whoever said that this will be replaced with -1 is mistaken.

ttyl,

--buddy
  #11   Spotlight this post!  
Unread 06-02-2007, 10:00
65_Xero_Huskie's Avatar
65_Xero_Huskie 65_Xero_Huskie is offline
One T
AKA: Mat
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Michigan
Posts: 697
65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute65_Xero_Huskie has a reputation beyond repute
Re: Robot style EOF?

We have an /EOF at the end of all our stuff. Whatever Chris Hibner does is his own thing. I never checked on it cuz it seems to work.

Quote:
#endif
/* EOF */
That is basically after everything, he must put it in for his own reference.
__________________
Min-Max to the Max!
  #12   Spotlight this post!  
Unread 06-02-2007, 15:48
kitscuzz's Avatar
kitscuzz kitscuzz is offline
Not alotta posts
AKA: Kit
FRC #1389 (Worst Case Scenario)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Home
Posts: 47
kitscuzz will become famous soon enough
Re: Robot style EOF?

Quote:
Originally Posted by Metalgod4eva View Post
Actually EOF does not identify the size of the file or the start of data. EOF stands for End Of File/stream and job to signal like a semicolon in C statements, that the particular data stream is finished. EOF is represented as -1 or '\o'. As a native C programmer I have never heard anyone ever mention that EOF was no longer a macro in the standard lib anymore ^ have I seen it even not been. I understand that when working with robot on partial C code that does not conform to ANSI or hides most the code in many files that you just assume that if you don’t run across EOF does not mean its not there. EOF is a macro and is used for every line of stream. AKA after every \n a -1 is placed. Think of it as more of an End OF line. http://www.cprogramming.com/faq/cgi-...wer=1048865140
In response to kitscuzz:
Char are 1 byte and 3 byte padding:
"EOF" is not a character, its -1 an int:
Name an OS does not use EOF:
When passing a string to a cam: A string is an array, there is no string support in C. So all chars are saved in ordnance of the 0th element to MAX-1 element, The MAX element is '\0' || NULL in a char array and '-1’ in and int array. /*Lets for argument sake allow NULL == EOF even though there different in the char array the eof follows null*/ That is also the reason Even if you never declared the array all the function for strings must use them, thus all strings use EOF, all arrays use EOF. Brain W. Kernighan and Dennis M. Ritchie creators of c have an ANSI Book read pages 17, 28, chapter 7 151, 242+. Have a great day!
For the camera thing, yes, you send individual characters to the camera. That was what I meant by "strings except to the camera, and then you really only send the characters and the line in terminated by a \r or \n, and wait for the camera to reply appropriately." You send the characters with no \0 (but I'm not sure whether or not the \0 needs to be sent, someone more experienced should confirm that).

I did not mean to imply that the EOF represented the size of the file, I was saying that the EOF has been replaced by the size of the file.

As for what the EOF is, it is only returned, as the URL you directed me to says, by functions that are reading files or input from the terminal or another application.

- EOF (0xff 0xff) is returned by fgetc() due to end of input

You can also trigger an EOF by typing into the terminal a predefined sequence into a terminal. This is what I meant by "OS-specific" because the sequence to send the EOF to a terminal is dependent on the OS (for example on a windows system it's ctrl+z).

As you said "EOF is a macro and is used for every line of stream." But unfortunately it is only triggered when you reach the end of a stream. This will NEVER HAPPEN unless you are reading from file or terminal, and when reading from a terminal, you need to have someone type an EOF (which won't be triggered while running the robot in normal conditions).

Anyway, the point is that since we don't use files, we don't recieve an EOF. Hope that clears up any confusion.
Closed Thread


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
2006 Robot Awards-CD Style JackN General Forum 18 21-05-2006 18:51
Style Changes Brandon Martus CD Forum Support 33 20-06-2005 11:17
Style suggestions evulish CD Forum Support 14 15-12-2003 23:01
New Style Brandon Martus Announcements 2 08-12-2003 01:48
style srawls Programming 19 23-05-2002 17:02


All times are GMT -5. The time now is 04:46.

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