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

input_state()

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



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

input_state()
PostPosted: Tue Jun 05, 2012 11:35 am     Reply with quote

Why level do not become '1'?
It shows me only LEVEL = 0
Code:

#include <18F2520.h>
#fuses NOWDT,NOMCLR,intrc
#use delay(internal=8M)
#use rs232(baud=9600, xmit=PIN_a1,rcv=PIN_a2)

void main()
{
while (true)
   {
   int level;
   output_high(pin_a0);
   delay_ms(500);
   level=input_state(pin_a0);
   printf("\fLEVEL = %d",level);
   }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 05, 2012 11:37 am     Reply with quote

Don't declare local variables (such as 'level') in the middle of code. Put
them at the start of the function.
rikotech8



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

PostPosted: Tue Jun 05, 2012 1:22 pm     Reply with quote

I'm so sorry I lose your time. The mistake was all mine. My code is for 18f2520 and I had test it on 18f2431. I don't know how the **** display works properly Shocked and some other functions don't. So the problem was solved!
Thank you anyway!
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