cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

Anonymous
Not applicable

 Hello Guys,

   

I want to use the Conversion Ready Interrupt of the ADCINC Modul. 
I write this small code (see Attachnment) to test this Function. I think the ADC should increase the Counter-Variable each Conversion and every Second the Counter should be displayed on my LCD. 
But it doesn´t work 😞

   

Can you please tell me my misstake?
Thank you very much!

   

Greetings
Daniel

0 Likes
15 Replies
ETRO_SSN583
Esteemed Contributor

To complete the interrupt setup you must modify the jmp vector in

   

boot.tpl, which resides in root project directory.

   

 

   

    

   

         

   

http://www.cypress.com/?id=4&rID=36720

   

      http://www.planetpsoc.com/component/content/article/43-writing-a-c-isr.html

   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hello,

   

thank you for an answer. I have tried it, but i doesn´t get any Numbers on my Display.
I have added

   

    org   20h                      ;PSoC Block DBB00 Interrupt Vector

   

ljmp _ADC_Int

   

    ;`@INTERRUPT_8`

   

    reti

   

to the boot.tpl.

0 Likes
ETRO_SSN583
Esteemed Contributor

The interrupt vector should be DCB02, if it is for the 16

   

bit timer.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

This might be of interest -

   

 

   

    

   

          

   

http://www.cypress.com/?docID=38567     AN42877

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hey,

   

thanks for this Application Note.
But I don´t need the Timer Interrupt. I need the Conversion Ready Interrupt for that ADC (I only want to know why it doesn´t work 😞 )

   

Greetings
Daniel

0 Likes
ETRO_SSN583
Esteemed Contributor

You might want to file a CASE on this. Looking at DS I do not see any enable/disable

   

over the interrupt, or a setting in global properties. Also seems to state, albeit sparsely,

   

that single stage modulator does not have any interrupt latency, does that mean there is

   

no interrupt ? And it discusses this as if < 12 bits also means no interrupt.

   

 

   

I am stumped.

   

 

   

    

   

          

   

To create a technical case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Expert II

Well, the solution is quite straightforward

   

1st: Do not modify the .tpl. In the boot.asm the correct interrupt for the ADC is already inserted.

   

2nd: Modify ADCINT.c- file and insert an lcall to your handler (NOT an LJMP!!!) into the marked place

   

3rd: Do NOT declare your handler to be an interrupt routine!!!

   

 

   

Bob

0 Likes
Bob_Marlowe
Expert II

Correction: Of course not the .c-file. Modifications have to be made in ADCINCINT.asm

   

 

   

Bob

0 Likes
ETRO_SSN583
Esteemed Contributor

Why cannot one use a C interrupt handler implementation ?

   

ADCINC is generated by 8 bit PWM, in this case placed in

   

DBB00. In order to do this boot.tpl would be changed and

   

an ljmp used.

   

 

   

http://www.cypress.com/?id=4&rID=36720

   

      http://www.planetpsoc.com/component/content/article/43-writing-a-c-isr.html

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

In the LCD module properties window your LCD is set

   

to bargraph enable, but your writes look like you want

   

the display for alpha-numeric display. If latter is true

   

set it to disable.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

@Dana

   

Boot.asm already shows an entry for DBB00 with an LJMP to _ADCINC_ADConversion_ISR which was automatically inserted by the module. The interrupt does NOT fire at end-of-conversion, but several interrupts are needed to form the result.

   

 

   

An end-of-conversion stub exists, clearly marked a bit down in the .asm-file (near line 150) where an LCALL should be placed.

   

 

   

Bob

0 Likes
Bob_Marlowe
Expert II

Obviously getting anonymusly...

   

 

   

Bob

0 Likes
Anonymous
Not applicable

 Hey Guys,

   

I have talked to the Support and they write this:

   

Greetings Daniel,

We have analysed the project FFT.zip you had attached.

Please use "lcall" (without interrupt_handler pragma directive) instead of "ljmp"(with interrupt_handler pragma directive) for jumping to "_ADC_Int" ISR routine in the ADCINCINT.asm file.

The reason is "ljmp" with interrupt_handler pragma directive results in an "reti"(return from interrupt) instruction being executed after the C ISR, and hence the code following the "ljmp" instruction would not be executed. So, in files such as ADCINCINT.asm, where there is still some other code to be executed after the User custom code banner, "ljmp" technique should not be used. Instead, "lcall" can be used. 

Please refer the below linked KB article which explains both "ljmp" and "lcall" techniques, and also a more advanced technique to overcome the "No Return to Assembly issue(but you may find that using lcall may be more simpler than the advanced technique mentioned there):

Implementing an Interrupt Service Routine in C on the PSoC1 

As seen in above link, when using "lcall", the interrupt_handler pragma directive should not be used. Rather, the lcall should be made as below in the custom user code banner:

PRESERVE_CPU_CONTEXT
lcall _foo
RESTORE_CPU_CONTEXT

We have made the above changes in your project(and have attached this), and verified on CY3210 kit that the LCD displays the expected correct data now. You can download the attached project by logging in to www.cypress.com->MyCases.

Please let us know if this resolves your query.

Thank you very much !

Best Regards,
Prem

   

I have tested it few minutes ago and it works 🙂
Thank you for your help! Now I try to implement my DFT Algorithm 🙂

Greetings
Daniel

0 Likes
Bob_Marlowe
Expert II

Glad to see that it works!

   

...and glad to see that my advice was right, I only thought that the CPU context already has been saved, but that was not quite right.

   

 

   

Bob

0 Likes
ETRO_SSN583
Esteemed Contributor

Interesting, so a C routine could also have been used with the module in

   

the note per below.

   


   

Please refer the below linked KB article which explains both "ljmp" and "lcall" techniques, and also a more advanced technique to overcome the "No Return to Assembly issue(but you may find that using lcall may be more simpler than the advanced technique mentioned there):

   



Implementing an Interrupt Service Routine in C on the PSoC1 

   

 

   

Regards, Dana.

0 Likes