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

INT_RDA2 issue PIC18LF46k80
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Oct 22, 2020 7:27 am     Reply with quote

OK, found it... 2nd post, after b).....
Guess I was focussed on the green 'restart_watchdog'......thinking...hmmm..wonder if that's causing a problem....
VincentJ



Joined: 21 Oct 2020
Posts: 9

View user's profile Send private message

PostPosted: Thu Oct 22, 2020 7:38 am     Reply with quote

The INT_RDA does not affect TO_UART2_ON :

Code:
#INT_RDA //RS232 RECEIVE DATA AVAILABLE - One CHAR is READY to be READ.   
void  RDA_isr(void)
{
  int t;         
 
   buffer[next_in]=fgetc(PORT1);         
   t=next_in;
   if(++next_in==BUFFER_SIZE)
   {   next_in=0;   }               
   
   if(next_in==next_out)   
   {    next_in=t;   }
     
   Compteur_Data_In++; 
                 
}       


In fact INT_RDA2 was on the same pattern and not disabled. I modified it as I tried to fix the issue.
In the version I showed you, INT_RDA2 clears the RDA2_TimeOUT counpter and then puts the 20ms timeout ON (the full trame duration is less 0.5ms).
When the timeout is reached in INT_TIMER0 (when RDA2_TimeOUT >= 3), INT_RDA2 is disabled and à flag is set (UART2_TrameRecue = 1;).
In the main loop : if the flag UART2_TrameRecue is set, the buffer is copied to another and INT_RDA2 is enabled.
VincentJ



Joined: 21 Oct 2020
Posts: 9

View user's profile Send private message

PostPosted: Thu Oct 22, 2020 8:09 am     Reply with quote

I tried without the WD but it doesn't change anything
VincentJ



Joined: 21 Oct 2020
Posts: 9

View user's profile Send private message

PostPosted: Thu Oct 22, 2020 9:02 am     Reply with quote

A little more :
I noticed a difference in the disassembly listing of the RDA2_isr between the versions that work and those that do not :
For those that does not work, each time, the compiler includes the reference name of a variable and I do not understand what it is doing there...
It is sometimes à global variable, sometimes à local one. In the exemple it is the name of a function argument which is called by EXT1_isr :

OK program :
https://www.dropbox.com/s/geqcl7jdxo639tu/prog_memory_ok.png?dl=0

NOK program :
https://www.dropbox.com/s/fvhb0ppy3sz4imn/prog_memory_nok.png?dl=0

INT_EXT1 code (which is known to be too long)

Code:
#INT_EXT1  // interruption des I2C IO EXTENDER
void  EXT1_isr(void)
{
//    EXT1_isr_Flag = 1;
//    Output_LOW(TEST_LED);

Disable_interrupts(INT_EXT1);   // Couper l'interruption Externe 1
Stop_WS2812_Stream=ON; // Indiquer au programme qui s'occupe d'envoyer la trame aux LED's quelle a été interrompu   
FLAG_INT_EXT1=1;
   
ClearOled=0; // indiquer que l'écran peut être effaçé
                                                                             
Refresh_HoistInformation=1; //  Indiquer qu'il faut rafraichir l'écran OLED
 
Programme_Buzzer (1,5,20); // un petit BIP!!   
                                 
//enable_interrupts(INT_EXT1); //  Ré enclencher l'interruption EXTERNE 1 

}               

Prototype :
Code:
void Programme_Buzzer (unsigned int8 NombreImpulsion,unsigned int16 DureeImpulsionON_ms,Unsigned int16 DureeImpulsionOFF_ms);
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Oct 22, 2020 9:18 am     Reply with quote

this...
Quote:
Programme_Buzzer (1,5,20); // un petit BIP!!

appears to be some kind of function using delays...25ms worth of them...

One should never, ever put (or call ) any function that has delays.
ISRs must be short and fast. Set a flag and let main() handle whatever action is required based upon the flag status.
VincentJ



Joined: 21 Oct 2020
Posts: 9

View user's profile Send private message

PostPosted: Thu Oct 22, 2020 9:27 am     Reply with quote

I understand but as far as EXT_INT1 is not triggered the program should work shouldn't it ?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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