Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Accessing groups of variables (http://www.chiefdelphi.com/forums/showthread.php?t=40640)

astro1652 27-11-2005 16:28

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. :confused:

Thanks!
~Zack
Team 1652

Alan Anderson 27-11-2005 17:55

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.

Mark McLeod 27-11-2005 19:36

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;


All times are GMT -5. The time now is 12:50.

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