ISR FLAG

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
chmoc_1567941
Level 4
Level 4

here ISR is calling only one time in my code ....

   

any one tell me where i put my flag for continue running program...

   

AND Second...

   

when i save all value in E2PROM then higher value save only one character instead of two character....where i mad mistake in declaration???

   

i attached my whole project.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You declared

   

char *strPtr1;

   

@Line 81

   

    switch (strPtr1[0])

   

You just declared a pointer, but it points into nirwana. Better declare

   

char strPtr1[2];

   

which will resolve that conflict.

   

Your interrupt handler is quite too large! Usually you just set a flag and exit. In the main-loop you check the flag, reset it when set and act accordingly.

   

 

   

Bob

View solution in original post

0 Likes
7 Replies
SampathS_11
Moderator
Moderator
Moderator
250 sign-ins 250 solutions authored 5 questions asked

Hello Chirag,

   

Under the source files, you will find a file called UARTINT.asm.

   

Find the label  _UART_RX_ISR.Below this line you will find commented out text as shown below

   

   ;---------------------------------------------------
   ; Insert a lcall to a C function below this banner
   ; and un-comment the lines between these banners
   ;---------------------------------------------------
   
   ;PRESERVE_CPU_CONTEXT
   ;lcall _My_C_Function
   ;RESTORE_CPU_CONTEXT
   
   ;---------------------------------------------------
   ; Insert a lcall to a C function above this banner
   ; and un-comment the lines between these banners
   ;---------------------------------------------------
   ;@PSoC_UserCode_END@ (Do not change this line.)

   

You can un-comment the three lines as indicated above, and modify the lcall to point to your function for handling Rx interrupts. 

   

lcall _UART_ISR

   

Be sure to remove the line

   

#pragma interrupt_handler UART_ISR

   

Sampath

0 Likes
SampathS_11
Moderator
Moderator
Moderator
250 sign-ins 250 solutions authored 5 questions asked

Hello Chirag,

   

Declare your string variables like 

   

char codestr[10];
char lowstr[3];
char highstr[3];

   

Replace the numbers representing the length of the array with the number of characters you need plus one, needed for zero termination of string.

   

Declaring the variable like *codestr, will reserve only one byte if in data space, and two bytes if declared in code space, just enough to store the pointer.

   

Sampath

0 Likes
chmoc_1567941
Level 4
Level 4

Thanks you sir for your reply.

   

i declared ISR as you mentioned and its working!!

   

but if i declared  char codestr[10] than E2PROM is not write data in perticular block.

   

is that mandatory to take char *codestr for E2PROM???

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When declared

   

char codestr[10];

   

Then codestr is already a char *

   

alternatively (char *)codestr[0]

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
chmoc_1567941
Level 4
Level 4

Thnk you BoB.

   

i got your point. i solved it. but still i facing one problem which is when sending data from UART than ISR function is activate and save data in EEPROM. but when i try it for second time than data is arrived in ISR but it is not stored in EEPROM.

   

i attached my project here.

   

can you tell me where i made mistake?? 

0 Likes
chmoc_1567941
Level 4
Level 4

when i power off psoc and power on than again it work for one time.

   

i have to make it like whenever correct data come on UART than ISR function activate and store data to EEPROM.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You declared

   

char *strPtr1;

   

@Line 81

   

    switch (strPtr1[0])

   

You just declared a pointer, but it points into nirwana. Better declare

   

char strPtr1[2];

   

which will resolve that conflict.

   

Your interrupt handler is quite too large! Usually you just set a flag and exit. In the main-loop you check the flag, reset it when set and act accordingly.

   

 

   

Bob

0 Likes