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

Cannot get rda_int working :S

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



Joined: 25 Jan 2007
Posts: 5

View user's profile Send private message

Cannot get rda_int working :S
PostPosted: Mon Apr 02, 2007 12:38 pm     Reply with quote

i use PIC18F4620 to control a robot. On my bot i have another pic (18f2620) and i use rda_int to receive command from the controller... from there, everything works perfectly. Now i try to send data back from the robot. But i cannot get rda_int working on the controller, no matter what i receive on the Rx pin it never interrupt... somebody can help me?

.h
Code:
#include <18F4620.h>
#device adc=8
#fuses NOWDT,WDT128,HS, NOPROTECT, NOIESO, BROWNOUT, BORV21, NOPUT, NOCPD, NOSTVREN, NODEBUG, NOLVP, NOWRT, NOWRTD, NOEBTR, NOCPB, NOEBTRB, NOWRTC, NOWRTB, NOFCMEN, NOXINST, NOPBADEN, LPT1OSC, MCLR
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
int Echantillon = 0;


.c
Code:
#include "C:\MAX\menu\afficheur.h"

#int_RDA
RDA_isr()
{
   Echantillon = getc();
}

void main()
{
   int i;
   static int iPositionCurseur[2] = {MINIMUM_X,MINIMUM_Y};
   static int iChoix = 1;

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF|ADC_TAD_MUL_0);
   setup_spi(FALSE);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   enable_interrupts(INT_RDA);
   enable_interrupts(GLOBAL);

   ...
}


Echantillon always equal 0 :(
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 02, 2007 1:06 pm     Reply with quote

Post your compiler version. It's a 4-digit number. It will look like this:
3.249, or 4.023, or 4.030, etc.

You can find it at the top of the .LST file. The .LST file is in your project
directory.
Corta



Joined: 25 Jan 2007
Posts: 5

View user's profile Send private message

PostPosted: Mon Apr 02, 2007 1:19 pm     Reply with quote

3.224
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 02, 2007 1:47 pm     Reply with quote

I don't have that version. The closest I have is vs. 3.230.

Try a simple test program, as shown below. Connect the 18F4620 to
the serial port on your PC, by using a MAX232-type chip. Then open
a terminal window on your PC and type in some characters. The
program shown below should receive those characters and send them
back to the PC, where they will be displayed on the terminal window.
Code:

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

#int_rda
void rda_isr(void)
{
char c;

c = getc();   // Get character from PC

putc(c);    // Send it back to the PC
}   

//========================
void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);

while(1);
}
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