Here is my whole program.
#if defined(__PCB__)
#include <12F683.h>
#fuses INTRC,NOWDT,NOPROTECT, NOMCLR
#use delay(clock=4000000)
#define GP0 PIN_B0
#define GP1 PIN_B1
#define GP2 PIN_B2
#define GP3 PIN_B3
#define GP4 PIN_B4
#define GP5 PIN_B5
#elif defined(__PCM__)
#include <12F683.h>
#use delay(clock=4000000)
#define GP0 PIN_A0
#define GP1 PIN_A1
#define GP2 PIN_A2
#define GP3 PIN_A3
#define GP4 PIN_A4
#define GP5 PIN_A5
#endif
void cycle_forward (void)
{
}
void cycle_backward (void)
{
}
void main() {
#if defined(__PCB__)
setup_counters (RTCC_INTERNAL,RTCC_DIV_2);
// See .h file for other special
// options for setup_counters
#else
setup_counters (RTCC_INTERNAL,RTCC_DIV_2);
#endif
while (TRUE){
if(!input (GP4)){
}
else{
output_high (GP0);
delay_ms (150);
output_low (GP0);
delay_ms (150);
output_high (GP0);
delay_ms (150);
output_low (GP0);
delay_ms (70);
output_high (GP1);
delay_ms (150);
output_low (GP1);
delay_ms (70);
output_high (GP2);
delay_ms (150);
output_low (GP2);
delay_ms (150);
output_high (GP2);
delay_ms (150);
output_low (GP2);
delay_ms (70);
}
}
}
it is in C language, and "works". what does not work is that it does not do the code when i hit a button on a breadboard. I programed this, and set it up all good. but it keeps doing that code unser the 'else' thing. when I have GP4 with negative, it keeps going. same when i have it high voltage. why does it not just do it once whenever i hit the button to make GP4 positive? I made the code into a seperate method and said if GP4=false, initiate the method, else do nothing, but it keeps looping and does not wait for me to hit the button or anything.
#if defined(__PCB__)
#include <12F683.h>
#fuses INTRC,NOWDT,NOPROTECT, NOMCLR
#use delay(clock=4000000)
#define GP0 PIN_B0
#define GP1 PIN_B1
#define GP2 PIN_B2
#define GP3 PIN_B3
#define GP4 PIN_B4
#define GP5 PIN_B5
#elif defined(__PCM__)
#include <12F683.h>
#use delay(clock=4000000)
#define GP0 PIN_A0
#define GP1 PIN_A1
#define GP2 PIN_A2
#define GP3 PIN_A3
#define GP4 PIN_A4
#define GP5 PIN_A5
#endif
void cycle_forward (void)
{
}
void cycle_backward (void)
{
}
void main() {
#if defined(__PCB__)
setup_counters (RTCC_INTERNAL,RTCC_DIV_2);
// See .h file for other special
// options for setup_counters
#else
setup_counters (RTCC_INTERNAL,RTCC_DIV_2);
#endif
while (TRUE){
if(!input (GP4)){
}
else{
output_high (GP0);
delay_ms (150);
output_low (GP0);
delay_ms (150);
output_high (GP0);
delay_ms (150);
output_low (GP0);
delay_ms (70);
output_high (GP1);
delay_ms (150);
output_low (GP1);
delay_ms (70);
output_high (GP2);
delay_ms (150);
output_low (GP2);
delay_ms (150);
output_high (GP2);
delay_ms (150);
output_low (GP2);
delay_ms (70);
}
}
}
it is in C language, and "works". what does not work is that it does not do the code when i hit a button on a breadboard. I programed this, and set it up all good. but it keeps doing that code unser the 'else' thing. when I have GP4 with negative, it keeps going. same when i have it high voltage. why does it not just do it once whenever i hit the button to make GP4 positive? I made the code into a seperate method and said if GP4=false, initiate the method, else do nothing, but it keeps looping and does not wait for me to hit the button or anything.