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
Posted: Mon Jul 19, 2004 8:53 am
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!
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