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

PORTt E, pin E0 when set to high cant output onto PORT D

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



Joined: 15 Feb 2005
Posts: 11

View user's profile Send private message

PORTt E, pin E0 when set to high cant output onto PORT D
PostPosted: Wed Feb 23, 2005 12:32 pm     Reply with quote

For some reason when I set pin E0 to high and in a if statement (bit_test (input_e(), 0) == 1 ), then output on to Port D, Port D does not get displayed. However once I get out of the if statement the port D value outputs for a second. As well in the if statement all of the other ports output fine, even Port D. Except when I set E0 to high. I am guessing I am setting a fuse incorrectly but if you can figure it out that would be great. Thanks

Code:


#include <18F458.h>     //up/down counter with 1 7 segment displays no max or min
#use delay(clock=20000000)    //check to see if casting works
#fuses HS, NOWDT,OSCSEN, BROWNOUT, BORV20, STVREN, NODEBUG, NOLVP

void main()
{
      set_tris_e(0x00);
      set_tris_c(0xFF);                          //hundreds display
      set_tris_b(0xFF);
   set_tris_d(0xFF);                  //tens display

   while(1)
   {   

    if(bit_test(input_e(), 1) == 1)      //E1 = 1
    {
      output_b(0xFF);            //All of the Ports output even D
       output_d(0xFF);
       output_c(0xFF);
       delay_ms(1000);

       output_d(0x00);
       output_b(0x00);
       output_c(0x00);
       delay_ms(1000);
    }
   
    if(bit_test(input_e(), 0) == 1)   // set E0 to 1 and it goes into the loop
    {
      output_b(0x0F);   
       output_d(0x0F);   //Port D does not display,but  Port C and B do display
       output_c(0x0F);
       delay_ms(1000);

       output_d(0x00);
       output_b(0x00);
       output_c(0x00);
       delay_ms(1000);
    }

   }
}
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Wed Feb 23, 2005 12:44 pm     Reply with quote

Use this instead:
if ((input(PIN_E1) == 1)

if ((input(PIN_E0) == 1)
_________________
David
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