|
|
View previous topic :: View next topic |
Author |
Message |
gtx15
Joined: 19 May 2018 Posts: 27
|
Variables |
Posted: Sat Nov 28, 2020 5:46 am |
|
|
Is there a way to see where a certain variable is used through out my program?
For example a variable called "c". I just cant search for "c" because it also in comments.
Thanks. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Sat Nov 28, 2020 6:02 am |
|
|
Easy answer....
Give it a better name ?? I know, kinda obvious, usually variable names reflect(tell) what they are used for. Easy with modern lanugages...when I started variables were limited to 1 or 2 characters.
I have to admit I use short names. I can't type so naming something like 'remote_temperature_sensor_number_1_from_greenhouse' isn't a good idea ! |
|
|
gtx15
Joined: 19 May 2018 Posts: 27
|
|
Posted: Sat Nov 28, 2020 7:19 am |
|
|
Found a way. If I comment out the declare line for that variable I get errors whenever that variable is used when compiling. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Sat Nov 28, 2020 7:55 am |
|
|
You might try getting a C Indexer/Cross Ref program that will give you a
list of all the variables and their location/use. There are a number of free ones out there.
Below is example output from an xref program I wrote for my own use in
Delphi years ago called CCSList customized for CCS code:
Code: |
***************************************************
Cross Reference Listing for the CCS "C" file:
>>>>>> ocraff.c
***************************************************
Include File Processing Option Not Selected
Number of lines in this source file: 409
INCLUDES:
#include <16F628.H>
FUSES LINE:
#fuses EC,PUT,WDT,NOPROTECT,MCLR,NOLVP,NOCPD
DEVICE LINES:
#device *=16 ICD=TRUE
#device *=16
PRIORITY LINE:
#PRIORITY RDA, TIMER1
DEFINES:
#define START_Signal_In PIN_A0 //pin 17 /pin RA0
#define AFF_Power PIN_A1 //pin 18 /pin RA3
#define buffer_len 0x40 // 64 chars
#DEFINE TIMER1START 21000 // ctr start value for 10ms timer
#DEFINE FLASH 50 // 50 x 10 = 500ms flash time
#define bkbhit (next_in!=next_out)
#define LED_ON 1
#define LED_OFF 0
#BIT DEFINES:
#no bit defines found
#BYTE DEFINES:
#no byte defines found
PROTOTYPES:
void serial_isr();
void process();
byte gethexbyte(char digit);
INTERRUPT ROUTINES:
#INT_TIMER1
#INT_RDA
VARIABLES LISTING: (* indicates the declaration line in the Main file)
=====================================================
cmd_buff: *101 ***** Not used *****
aff_data_in: *103 ,274,277,291,327,329
aff_idle: *103 ,198,275,285,313,337
bad_packet: *103 ,286,317,322,331,340
curr_cmd: *102 ,350,354
c: *103 ,164,166
CRC_IN: *103 ,298,300,301,308
t: *103 ,149,154 |
_________________ Google and Forum Search are some of your best tools!!!! |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|