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

16F690 Receive Interrupt ???

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



Joined: 25 Oct 2004
Posts: 136

View user's profile Send private message

16F690 Receive Interrupt ???
PostPosted: Fri May 14, 2010 3:18 am     Reply with quote

Hello Friends,,

I run into a confusing problem with a new project using F960

The PWM Output works fine, the key is recognized correct, the PWM is switched to the new value, XMIT of the little message at 115200 baud works perfect.

BUT I cant receive any data , can somebody give me hint ??

Any asnwers very appriciated

best regards
Andreas(Vienna/Austria)



Code:
#include <16F690.h>
//#device ICD=TRUE
#fuses HS,NOWDT
#use delay(INTERNAL=8MHz)
#use rs232(baud=115200,parity=N,BITS=8,XMIT=PIN_C0,RCV=PIN_C1,stream=com1,errors)

#define HOLD PIN_A2

INT i;
int1 lase = 0;
int1 keyp = 0;
long d;
long off;
int pr;
long ticker = 10;

#int_RDA
void Interrupt1USART (void)
{
   BYTE ch;
   output_toggle(HOLD);
   ch = getch(com1);
   putc(ch,com1);
}

#int_timer1
void timer1_isr()
{
   set_timer1(0x3B00);        // Setupt Timer1 as 100ms Timer 3B00
   ticker++;                   // Increment 100ms Timer
                           
   if (ticker > 10)
      {
      ticker = 0;
      fprintf(com1,"TEST");
      }
}


void main()
{
SETUP_TIMER_2(T2_DIV_BY_4,100,1);
SETUP_CCP1(CCP_PWM);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_4);
enable_interrupts(int_timer1);
enable_interrupts(INT_RDA);
enable_interrupts(global);
set_TRIS_C(0x82);

d = 200;
pr = 0;
i = 'T';
off = 2;

SET_PWM1_DUTY(d);
lase = 0;
while(TRUE)
{

if (keyp == 0)
   {
   if (input(PIN_C7)==1)
      {
      lase = 0;
      SET_PWM1_DUTY(off);
      }
      else
      {
      lase = 1;
      SET_PWM1_DUTY(d);      
      }
   }
}
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19359

View user's profile Send private message

PostPosted: Fri May 14, 2010 4:01 am     Reply with quote

The receive interrupt, will only fire, when the _hardware_ UART receives a character.
What pins is the hardware UART connected to on the 690 (it is _not_ pins C0/C1....)?.
Till you use the right pins, the UART won't work...
Look at the data sheet. RX, and TX pins.

Best Wishes
Andreas



Joined: 25 Oct 2004
Posts: 136

View user's profile Send private message

PostPosted: Fri May 14, 2010 4:19 am     Reply with quote

Hi Ttelmah,

Thanks for Your fast reply, of course I am using
Receive Pin is RC1, TX Pin is RC0.

That´s really something which is not clear for me, unfortunately this chip needs a special header to be debugged with the ICD.

best regards
Andreas
Ttelmah



Joined: 11 Mar 2010
Posts: 19359

View user's profile Send private message

PostPosted: Fri May 14, 2010 4:25 am     Reply with quote

Look at table 5 in the data sheet.
RX, is pin B5, and TX is pin B7. The UART will _only_ work, if you use these pins.

Best Wishes
Andreas



Joined: 25 Oct 2004
Posts: 136

View user's profile Send private message

PostPosted: Fri May 14, 2010 6:42 am     Reply with quote

Hi,

Yes, thats what I thought at the beginning, I was doing it at first with the use rs232 statement and I was thinking that this is using the standard IO Pins but I could see that the Data was coming out at A1 instead of the B Port Pins.

But anyhow now I will try it with Your suggestion !

Thanks for Your quick help, will try it on sunday night

best regards
Andreas
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