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

my interrupts on change cant work...

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







my interrupts on change cant work...
PostPosted: Fri Aug 08, 2008 7:02 pm     Reply with quote

hi, my interrupts on change cant work, temp is always is zero...
input for
#define X_IN input(pin_b5)
#define Y_IN input(pin_b6)
is PWM, how to get it work?
compiler=v3.249

Code:
#include <16F917.h>
#device adc=8

#FUSES NOWDT                      //Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES NOPUT                    //No Power Up Timer
#FUSES PROTECT                  //Code protected from reads
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOCPD                    //No EE protection
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES NOFCMEN                  //Fail-safe clock monitor disabled
#FUSES NODEBUG                  //No Debug mode for ICD

#use delay(clock=4000000)
#use fast_io (B)
#define LCD_ON
#define X_IN input(pin_b5)
#define Y_IN input(pin_b6)
#define OUT_LED PIN_B3
  #ZERO_RAM

INT1 start=0;
int8 cnt=0;
int16 temp=0,X_VAR=0,Y_VAR=0;

#int_RB
RB_isr()
{
   temp=get_timer1(); clear_interrupt(int_RB);
}


#include "LCD1.c"


void main()
{

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_spi(FALSE);
   setup_lcd(LCD_DISABLED);
   setup_timer_0(RTCC_INTERNAL);//setup_wdt(WDT_DIV_512);
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
 set_tris_b (0b11110111); 
   enable_interrupts(GLOBAL);enable_interrupts(INT_RB);
   setup_oscillator(OSC_4MHZ);
set_tris_a (0xff);


output_high(OUT_LED);
delay_ms(100);
output_low(OUT_LED);


      lcd_init();
            lcd_gotoxy(1,1);
            printf(lcd_putc,"A sensor              ");



while(1)
{
   restart_wdt();


cnt++;

            lcd_gotoxy(1,1);
            Printf(lcd_putc,"GX=%lu  T=%lu       ",X_VAR,temp);
            lcd_gotoxy(1,2);
            printf(lcd_putc,"GY=%lu  C=%u       ",Y_VAR,cnt);


}//while
}//main
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 08, 2008 7:39 pm     Reply with quote

Read this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=32735
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