- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When declared
char codestr[10];
Then codestr is already a char *
alternatively (char *)codestr[0]
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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