cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

Anonymous
Not applicable

 Hi People,

   

 

   

I'm using an UART to give user info thru RX buffer and then make decisions based on RX interrupts triggered by the same. So when I give a character i/p for the first tym, branching to ISR occurs but when I try to give another user-input to be received by the RX buffer (when I'm inside the ISR) and read the RX buffer through a variable, say choice, [choice=UART_cReadChar(); ], choice is left with only the previous user value & controls goes to the beginning of the ISR.

   

 

   

I'm not able to over-write the contents of RX buffer when I'm inside the ISR, which is essential to branch it to appropriate code fragments in functions. Can this be done ? please help.

0 Likes
7 Replies
Anonymous
Not applicable

Project archive attached. Please help. Special mention - Bob & Dana. 

   

 

   

Thanks,

   

RAM

0 Likes
Anonymous
Not applicable
0 Likes
Bob_Marlowe
Expert II

This is not the way interrupt routines are ment to be used. Imagine, that as long as the isr is executed no other interrupts will be served. The output of a string will stall your system for a comparable long time.

   

Usually (as you see it is not my first time) I write a "Circular Buffer" to save the characters I receive from within the ISR. in the main-loop I check the buffer for containing a character, if so, read it off the buffer and handle appropiately.

   

 

   

Bob

0 Likes
Bob_Marlowe
Expert II

... and as I just see, you enabled in the UART the command buffer which you cut off with the LJMP to your ISR. Disable the buffer to save some space in flash and ram.

   

 

   

Mean Bob

   


 

0 Likes
Anonymous
Not applicable

Bob,

   

 

   

Thanks a lot. I wasnt aware that they had themselves configured RX of UART as an ISR.

   

I want to convert a string to a double value. Say in, the last proj I uploaded, I want to convert the gain the user enters into a string after I terminate the same with a '\0'. I tried using the "atof" function imagecraft provides. But it says datatype mismatch. No assignment statement for const char

   

 

   

Do tell me the syntax for the same. For eg., a double variable cval = atof(*ptrval); - Is this correct ? Correct me if I'm wrong

   

RAM

0 Likes
ETRO_SSN583
Esteemed Contributor

According to the description, atof() wants a ptr to a string as an argument, and returns a double

   

as an error code.

   

 

   

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Dana,

   

 

   

I did see that description of atof in Compiler user guide. I'd followed the same syntax but didnt get the converted o/p.  No errors are seen when I compile the code. 

   

Help me with the syntax. or mayb attach an archive, a simple one. if you can get a string converted into double and upload it here. It shudn take much of yur tym, I'm sure.

   

 

   

Thanks,

   

RAM

0 Likes