Go to Post Reading the directions is as important as reading the manual. - the man [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 27-11-2005, 16:28
astro1652's Avatar
astro1652 astro1652 is offline
Registered User
FRC #1652 (Team Overdrive)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Kenosha
Posts: 2
astro1652 is an unknown quantity at this point
Accessing groups of variables

Hello All,
Is there anyway to access an entire group of variables in one statement? I was thinking maybe it would be possible with arrays, but how can you set all of the elements at once? Using a structure maybe?
The reason I'm asking is that I want to access all of the OI's LEDs at one time instead of wasting valuable time on all 8 seperately. In assembly, accessing a full port is a snap, and I would think it would be easy enough in C.

Thanks!
~Zack
Team 1652
  #2   Spotlight this post!  
Unread 27-11-2005, 17:55
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: Accessing groups of variables

Quote:
Originally Posted by astro1652
Is there anyway to access an entire group of variables in one statement? I was thinking maybe it would be possible with arrays, but how can you set all of the elements at once? Using a structure maybe?
Yes, the typical way is to use a structure (often with variant records).

Since you're specifically asking about the OI LEDs, take a look through the definition files in the default code from IFI. The individual LED bits are already part of a structure that you ought to be able to set directly.
  #3   Spotlight this post!  
Unread 27-11-2005, 19:36
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,847
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Accessing groups of variables

Specifically for the OI LEDs, if you look in the default code you'll see where all the 8 OI LED bits are addressed at once in user_routines.c at the very end. Ypu should backtrack as Alan suggested to understand why this is so.

Code:
User_Mode_byte = backup_voltage*10;
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 27-11-2005 at 19:41.
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
User Groups Brandon Martus CD Forum Support 10 08-03-2004 15:31
Need help with Variables ? David Bryan Programming 5 23-02-2004 07:42
Joystick Variables fred Programming 8 20-02-2004 10:58
VB Program to monitor robot variables DanL Programming 7 15-02-2002 22:35


All times are GMT -5. The time now is 08:02.

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