Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

 Hello, I have tested my programs with different resolution of ADC in 8MHz (According to the datasheet, this is the maximum dataclock for the module). The ADC values are then trasmitted to a virtual terminal through UART. It is interesting that the ADC has significant chattering bit in ADC resolution which are higher than 8bit.

   

These are some examples that I get when the analogue input are connected to ground:

   

8Bit (In Hex Form)

   

0001

   

0002

   

0001

   

0002

   

0001

   

0001

   

0002

   

0001

   

...

   

...

   

 

   

9bit or higher resolution (In Hex Form)

   

0001

   

0002

   

0002

   

0001

   

0002

   

0001

   

0002

   

0001

   

...

   

...

   

0102

   

...

   

...

   

0101

   

...

   

...

   

 

   

   

Are these mainly caused by the 8-bit PWM cycles in the ADC module? Please correct me if I have made any misconceptions.

   

Thank you very much.

   

   

Thank you very much.

0 Likes
5 Replies
Bob_Marlowe
Expert II

When you get a 0x0102 when the input is tied to GND there is someting darn wrong. Can you post an actual project here.

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

   

Thanks for your quick reply. Here is my project. The code is actually based on the example from CY8C3210-PSOCEVAL: C_Example_ADC_UART_LCD.

   

Once again, thank you very much.

0 Likes
Bob_Marlowe
Expert II

First I noticed that you are using outdated versions of ADCINC and UART. I strongly suggest (and if it is for experimental usage only) to update to the latest versions!

   

I found 2 warnings when generating (after a clean) the project anew:

   

The CPU-clock is set to 8MHz which is not more (as required) than the ADCINC-clock (which I would set to 4-6MHz while testing)

   

SysClk*2is disabled which is re-enabled while debugging. I would suggest to have it generally enabled.

   

 

   

There are some (more cosmetic) issues I found.

   

The UART TX interrupt is enabled, but unused. I would disable it.

   

There are two ADCINC-module parameters not set and so are undefined, I would set them to reasonable values:

   

NegInput (set to same as posinput

   

PWMOutput (set to None)

   

 

   

It is rather uncommon in the world of embedded µControllers to end the program (after 1000 conversions) this you will have to change for final releases to an infinite loop.

   

 

   

Two (cosmetic) C-usages:

   

if(condition != 0) is usually written as if(condition)

   

and

   

Value = Value + 1; is done with Value++; which is not only less to type but may generate less code.

   

 

   

Happy coding

   

Bob 

0 Likes
Anonymous
Not applicable

  Hi Bob,

   
    

I have modified my codes according to you guidance and now the code just works well~ And how can we actually disable the UART TX interrupt? Is it just changing 'TXEmpty' to TXComplete'?

    

Thank for your patience, once again.

   
0 Likes
Bob_Marlowe
Expert II

Got your mojo workin' ! Fine

   

Tx interrupt cannot be disabled in PSoC1, sorry, my fault!

   

 

   

Bob

0 Likes