CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Always false warning

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Scotty
Guest







Always false warning
PostPosted: Mon Jul 19, 2004 8:47 am     Reply with quote

PCWH 3.206

I have something curious happening in my program and was wondering if anyone can explain it.

In line 17 below " if (!aff_power) init_done=0;" gives me a warning that it will always be false but the line works as it should.

I was wondering if anyone knows why i am getting the warning?

******
Code:

#define  AFF_Power   PIN_A1  //pin 18 - pin RA1

int init_done;

<snip>

        restart_wdt();
        //
        // read the switch state to get start signal status
        start_signal = input(pin_A0);  // get start signal input

        if (input(MP_BOL)==unblocked){
            Jam_flag=0;
            jam_timer=0;
        }

        if (!aff_power)
                        init_done=0;

 // Is the MP BOL blocked?
        if ((input(MP_BOL)== blocked) && (idle == 0))
           {
            if (jam_flag==0) // is this the first time seen?
            {
                jam_stop=0;
                jam_flag = 1;  // if so, start timer and set flag
                Jam_Timer = JAM_TIME;
            }
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Mon Jul 19, 2004 8:53 am     Reply with quote

I'm supprised it works at all.

The PIN_Ax assignments (as I understand them) are not the port addresses themselves. You are doing the same basic operation as

if (!22) init_done=0;

(substitue the value of PIN_A0 from your header file for 22).

You should either use the input_pin() function or use the #byte and #bit feature to map your pin to a variable.

FYI, if you use the input_pin() function then #use standard_io() will work as well as #use fast_io() and #use fixed_io()

However if you use the #byte and #bit you must set the pin direction by programming the appropriate TRIS register.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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