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

coding help

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 04, 2007 12:16 pm     Reply with quote

To me, it just sounds like you're making more complicated then it
needs to be. I made the following test program for a PicDem2-Plus
and it displays an incrementing number as I press the tactile switch
that's connected to Pin B0. Here's the output displayed on a terminal
window:
Quote:
123123123

Code:

#include <18F452.h>
#fuses XT, NOWDT, PUT, BROWNOUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#define BUTTON_PIN  PIN_B0   // This pin must have a pull-up.
#define DEBOUNCE_PERIOD_IN_MS  10
#define DEBOUNCE_COUNT  2

void wait_for_keypress(void);

//====================================
void main()
{
int value;

value = 0;


while(1)
  {
   wait_for_keypress();
   value++;

   if(value == 1)
      printf("1");

   if(value == 2)
      printf("2");

   if(value == 3)
     {
      printf("3");
      value = 0;
     }
  }

while(1);
}

//==================================


void wait_for_keypress(void)
{
// Put the function code here from the link that
// I posted earlier in the thread.   
 
}
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