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 CCS Technical Support

what wrong

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







what wrong
PostPosted: Fri May 22, 2009 11:47 am     Reply with quote

Code:
#include <18F4550.h>
#fuses HS,NOWDT,NOPUT,NOPROTECT
#use delay(clock=20000000)

#define s1 PIN_B1
#define s2 PIN_B2

void main()
{

while(1)
{
output_low(PIN_D7);

   while(input(s1))
   {
       while(input(s2))
       {
        output_high(PIN_D7);
       }
   }

   while(!input(s2))
   {
   output_low(PIN_D7);
   }
}
}
This is my simple code to test my mcu. This code is waiting for logic high to pin_b1 and pin_b2 . But when I use this code the mcu pin_d7 go to high, but pin_b1 and pin_b2 are logic low. Why ???
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri May 22, 2009 1:50 pm     Reply with quote

You are missing to NOLVP fuse - are you sure the PIC is not being help in programming mode?
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
apcaye



Joined: 22 May 2009
Posts: 29
Location: Brazil

View user's profile Send private message

PostPosted: Mon May 25, 2009 2:50 pm     Reply with quote

Have you initialized the TRISB and TRISD registers? They indicate whether a pin is an input or an output. Do you have a pull-up or pull-down resistor connected to pins B1 and B2? If there is nothing connected to these pins, they can assume any value (0 or 1).

Regards,
Adriano.
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