Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > Coding For PSOC creator

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Coding For PSOC creator
Moderator:
RKRM

Post Reply
Follow this topic



Coding For PSOC creator

sinny posted on 23 Nov 2011 7:54 AM PST

1 Forum Post

I m new to PSOC. SO is there anyone who can help me in writing the coding for the implemantation of the OR gate in PSOC  ceator. The LED glows when the output is one......I really need the coding.........I have assign P0.1 and P0.1 as the input terminals and P0.3  is connected to the LED.




Re: Coding For PSOC creator

kmmankad posted on 23 Nov 2011 08:40 AM PST
Top Contributor
268 Forum Posts

Hey sinny,welcome to the fascinating world of PSoC ;)

About your query,

To add the OR component:

Goto 'Digital' in the component catalog,and then double click 'Logic' as well,to expand it.The OR Gate component is listed here.Simply drag it into your top design view(the white canvas central in the IDE).

Add 2 Digital Input Pins, and a Digital Output pin the same way.(you'll find these under the 'Ports & Pins' section of the Component catalog.

You should have something of this sort by nw:

Click the second icon from top in the vertical toolbar shown in the image below and wire the components.Heres another pic:

Head over to the configuration section.Access this by double clicking on the .cywdr file in the Workspace Explorer window,and goto the Pins tab in the interface that shows up.Assign them there from the drop down,and its only programming of the kit left from then on.(use F5 to do a build,program and then debug of your project.)

Thats it!

Hope this helps.



Re: Coding For PSOC creator

U2 posted on 25 Nov 2011 03:39 AM PST
Cypress Employee
589 Forum Posts

As illustrated in the previous post an OrR gate can be used to implement OR logic. This is completely implemented in hardware. It uses the UDB fabric in PSoC3 to implement this. Note that same thing can be done in code as well. There are plenty of gates and other digital logic(D FLip Flop, Counters, Quadrature deocder and so on) available in the component catalog in PSoC Creator. You can use these to implement complex digital logic.



Re: Coding For PSOC creator

neha posted on 05 Jan 2012 01:37 AM PST
Top Contributor
85 Forum Posts

 Hi!

I've jst started using PSoC. I have CY8C001 development kit, through which i have to build an application to count negative(or positive) pulses appearing at input. the pulses to be counted have to be above some threshold value and the output is required in cps. How should i start?



Re: Coding For PSOC creator

Bob Marlowe posted on 05 Jan 2012 02:00 AM PST
Top Contributor
1768 Forum Posts

Welcome in the PSoC society!

Install the PSoC Creator 2.0 Program, sit back and relax, go to the videos webside (selectable from the top of this very page) and look at some of the fundamental procedures to build a project.

then have a look at the datasheets: the comparator, the counters, the Cahracter-LCD-module (hopefully you've got one in your Kit)

Get together the needed APIs, Initialize your hardware and - its done!

 

Happy coding

Bob



Re: Coding For PSOC creator

Gautam Das posted on 05 Jan 2012 02:09 AM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

According to the description of your requirement, you need to continuously count the number of pulses which you receive and express it in counts per second.

Also, the a pulse is to be considered only if it exceeds certain (voltage) threshold.

 

So, this design has 2 requirements.

First, to determine if the signal exceeds the threshold. This can be achieved with the aid of a Comparator along with the threshold reference. This threshold can be an external voltage (external to PSoC), or an internal reference like Voltage DAC (VDAC).

Second requirement is to count the number of pulses in a window of 1 second. This can be achieved with the use of a Counter Component available in PSoC Creator Component Catalog. Also a signal which generates 1 second window is required for this purpose.



Re: Coding For PSOC creator

Gautam Das posted on 05 Jan 2012 02:41 AM PST
Cypress Employee
742 Forum Posts

Implementing these two requirements, the schematic will look as shown below:

 

 

 

Here, the Voltage DAC (VDAC) is used to set the threshold at the inverting input terminal of the comparator. The non-inverting input terminal of the Comparator is connected to the input under observation (Input_Pulse). The output of the comparator is either high or low. This input can then be fed to the Counter's Count terminal for counting.

 

A PWM Component is configured such that it generates pulse with a period of 1 second. The terminal count (tc) of the PWM component generates a pulse every second. This is fed to the Capture input terminal configured as "Rising Edge" triggered.

The Counter is configured as upcounter and the "Reload on Capture" feature is enabled. Hence upon every capture, the present count value is dumped to the FIFO and the counter is reloaded with 0. This will free the user from resetting the counter every second using firmware.

The Interrupt Component (isr_1) is used after configuring the counter to generate an interrupt on Capture. Hence, the user can read the captured value in firmware and use the value thus obtained. This value can be displayed on a Character LCD.



Re: Coding For PSOC creator

Bob Marlowe posted on 05 Jan 2012 02:42 AM PST
Top Contributor
1768 Forum Posts

@dasq: The length of the window to count may be any other length, not only one second. You'll have just to re-calculate the sps value. This is especially required when the frequency to count is near or even below 1 Hz.

Happy counting

Bob



Re: Coding For PSOC creator

Gautam Das posted on 05 Jan 2012 02:49 AM PST
Cypress Employee
742 Forum Posts

That's absolutely right, Bob!

When the input pulse frequency is less than 1Hz, we may have to use a larger window and appropriately scale down the result.

On the other hand, if the input frequency is very high, updating the counts every 1 sec might be too long (depending upon the user requirement). Using smaller window and updating the counts/sec more frequently is also aother option.



Re: Coding For PSOC creator

Gautam Das posted on 05 Jan 2012 04:30 AM PST
Cypress Employee
742 Forum Posts

Another technique to measure the frequency of the pulse is to measure its time interval.

This thread discusses the technique mentioned above.



Re: Coding For PSOC creator

neha posted on 09 Jan 2012 10:13 PM PST
Top Contributor
85 Forum Posts

Thnx Bob, thnx dasg!!! 

I've got some valuable help. The aim of the project is to embibe as many features in the chip as possible.

I'll try to take reference frm VDAC then. Actually these pulses are output of some detector , a completely random process (rather poissons' distribution is followed). 

is it possible that i initially generate TTL pulses through software at random intervals and count them in the absence of detector ?   



Re: Coding For PSOC creator

Gautam Das posted on 09 Jan 2012 11:34 PM PST
Cypress Employee
742 Forum Posts

It is possible to generate pulses through software and and count them if you don't have the detector (source of pulses).

You can also use a PWM Component to generate pulses, vary it's frequency and observe that the output reading reflects the same.

 



Re: Coding For PSOC creator

Bob Marlowe posted on 09 Jan 2012 12:12 AM PST
Top Contributor
1768 Forum Posts

Or youse the bitstream output of a PRS-module with an apropiate  clock, connect it to an output pin and use this as input to yout logic. Remember, that these pulses are of random length.

 

Bob



Re: Coding For PSOC creator

Gautam Das posted on 10 Jan 2012 12:56 AM PST
Cypress Employee
742 Forum Posts

A code example for frequency measurement using Counter is attached along with this comment.

However, the analog front end is not taken care of in this project. Hence, the comparator, VDAC should be used as mentioned before in this project prior to feeding it to the Counter's Count terminal.



Re: Coding For PSOC creator

neha posted on 13 Jan 2012 01:40 AM PST
Top Contributor
85 Forum Posts

I am unable to open this file, this is the error msg-

Error: prj.M0051: Unable to open the workspace "C:\Users\Administrator\Desktop\PsoC\Counter_FreqMeasurement\Counter_FreqMeasurement.cywrk": (Unexpected xml node type encountered: workspa, expected: CyGuid_). Address the error and try again.

 

 

 



Re: Coding For PSOC creator

Gautam Das posted on 13 Jan 2012 02:53 AM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

Make sure that you have installed PSoC Creator 2.0 (latest version) in your PC.

If you haven't, you can download the same from the following location:

http://www.cypress.com/?id=2494&source=home_documentation

 

I was able to download the project, open it and build it successfully without any error at my end.



Re: Coding For PSOC creator

PRATEEK posted on 23 Jan 2012 03:02 AM PST

1 Forum Post

 HI,i have the development kit CY8CKIT-001.I wish to use it for my project-"Digital voice Recorder". Please, suggest me a processor module among psoc-1,psoc-3 and psoc -5. and also a book or a site for programming for psoc.

              Thank  you 



Re: Coding For PSOC creator

kmmankad posted on 23 Jan 2012 05:54 AM PST
Top Contributor
268 Forum Posts

Hey PRATEEK,

you should go for either of PSoC3 or 5.To implement a digital voice recorder,you'd need to hookup a microphone to an ADC which I presume would be logging this data to some medium of mass storage,which could be some SPI flash memory,or an SD card,using DMA.

As for learning resources for PSoC3,here is a link that should help you along www.cypress.com/

A similar set of resources are there for the PSoC5,which you can find here www.cypress.com/

Also,please start a seperate topic for this.

 

 



Re: Coding For PSOC creator

neha posted on 07 Feb 2012 11:17 PM PST
Top Contributor
85 Forum Posts

dear all!
  I have a CY8C001 kit. As per your suggestion i have downloaded PSOC creator version 2.0 and tried to build some example projects on it. As soon as the editor opens there is a warning statement that it failed to establish connection with external programmer.However the projects are built successfuly. But as soon as i try to program it  through 'Program' option in menu there are no options seen of the device.I have cross checked that mini programmer is configured correctly as given in the guide. It was not a problem when i used Creator 1.0.
I uninstalled the programmer and reinstalled it from the CD given in the kit: only the programmer from 'PSoC programmer' folder.  Instead of using it through creator, i tried to program hex file through programmer again configuring mini programmer through recommended settings.It reads the device, erases it.The LEDs of programmer are glowing as well but as soon as i try to burn a hex file in it, it shows device compatibility issues. Please help :(



Re: Coding For PSOC creator

U2 posted on 07 Feb 2012 12:15 AM PST
Cypress Employee
589 Forum Posts

 Neha, from your comment what I undersatnd is, you are having difficulty programming the devie due to incompatibility with the target selected. What this means is that the device for which the project is built and the device that is acquired(the device on the CY8CKIT-001) are different. Make sure that the project is built for the same device as that on the kit. If you take a close lookat the PSoC3 processor modul you will be able to find the part number and the revision of the chip. CY8C3866AXI-040 ES2 or CY8C3866AXI-040 ES3. Select the same device in the PSoC Creator environment, you can do this as follows,

Re: Coding For PSOC creator

neha posted on 07 Feb 2012 01:19 AM PST
Top Contributor
85 Forum Posts

Thnx U2,

the image u attached is not opening. 

Actually what i expected was that like in version1.0 the device would be programmed through 'program' option in creator itself.But this is not happening. I never used device selector then.As soon as it sensed connection to DVK it reported device part number in the mini programmer tree. All I had to do was 'connect' and 'port acquire'.

Since device was not detected this time through Creator, I installed Programmer separately and configured it outside creator.A hex file of UART_Rx was imported. It itself reported part number of the device detecting connection, not to mention that it was read and erased as well!  but as soon as this hex file is written, the process 'fails'Is it so that this programmer can be used only with CY8C29XXXX series or projects c*current status and issue*--reated through PSoC designer? I am using it for a  PSoC creator  example. I'll copy and give u the exact error appearing.

should i uninstall all softwares and reinstall them through CD (version1.0 again)?  How can the programs be burnt from within the window of Creator 2.0 . it doesn't even recognise if mini programmer is connected, no LEDs blinking on programmer!



Re: Coding For PSOC creator

neha posted on 07 Feb 2012 01:23 AM PST
Top Contributor
85 Forum Posts

 here's the errormsg:

trn.M0004: There was a problem communicating with the external program PSoC Programmer. Ensure that it is installed and operating properly. This may prevent the use of some communications devices



Re: Coding For PSOC creator

neha posted on 07 Feb 2012 02:50 AM PST
Top Contributor
85 Forum Posts

programmer updated to 3.14, think it should work now 



Re: Coding For PSOC creator

U2 posted on 07 Feb 2012 03:10 AM PST
Cypress Employee
589 Forum Posts

 Using the latest version of the PSoC programmer might work. Just give it a shot and let us know if it works.



Re: Coding For PSOC creator

neha posted on 09 Feb 2012 12:49 AM PST
Top Contributor
85 Forum Posts

 well..the error of unable to connect to external programer is not seen now as soon as the Creator is loaded. I've yet to see that programmer detects the device or not.

All the projects written in Creator1.0 are not upgradable to 2.0. what i see is a blank project if it is opened through 2.0 .If I try to open those projects through 1.0, instead of components some blank boxes are seen in same projects. although a zip file of backup is created that contains the project in its older ways, I have to develop all those projects again to see them working :(



Re: Coding For PSOC creator

U2 posted on 09 Feb 2012 01:14 AM PST
Cypress Employee
589 Forum Posts

 Nehas, you dont have to create the project all over again. All you need to do is, upgrade all the components to latest version. You can do this by rightclicking the project in the workspace and launching the component updater. In the component updater click update all components to latest and say ok. You should be fine after this. 



Re: Coding For PSOC creator

Gautam Das posted on 09 Feb 2012 01:14 AM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

You can update the components of a project created in Creator 1.0 to Creator 2.0 by going to Project > Update Components > Update All to Latest > Next

If at any given point, you want to revert back to using your old Creator 1.0 project, you can use the "backup" project which is automatically created when update is done.



Re: Coding For PSOC creator

neha posted on 09 Feb 2012 04:15 AM PST
Top Contributor
85 Forum Posts

 Thnx Uday and dasq,

I've updated the components.I've tried to build Ex3_ADC_to _uart_with_dac , a eg. project in CY8C001Kit_user_guide. Build suceeded.! The Mini programmer was also detected from menu "Select debug target". I Burnt the program on the chip:CY8C3866AXI-040 on DVK (cY8C001) But neither the voltage counts displayed changed from 0 while i tuned the potentiometer nor there was any data on hyperterminal.Although programming was shown successful in creator. there are 2 things i suspect:

1. I rechecked the components' configuration :UART, Clock , DMA and ADC. Their configuration has changed after upgradation Eg. parameter 'hw_request_enable' in DMA that had true or false value in version1.0 can  take these options: Derived, diasbled,Level or risisng edge in version 2.0

3. The silicon is not the same..i've not upgraded the hardware. the device number is mentioned above , i dunno this ES is supported or not. Its the one stipulated with kit in CY8C38 family processor module.

 



Re: Coding For PSOC creator

neha posted on 09 Feb 2012 04:35 AM PST
Top Contributor
85 Forum Posts

 there's a migration guide on website it says 

'If your old design contains a device that is not available, a dialog will display prompting

you to select a replacement device"

there was no such prompt, is there a possibility that target device is not supported. how can i see a list of supported part numbers inPSoC creator window?



Re: Coding For PSOC creator

Gautam Das posted on 09 Feb 2012 08:49 PM PST
Cypress Employee
742 Forum Posts

You can find out the version of the silicon by reading the name inscribed on it, like CY8C3866AXI-040ES2 or CY8C3866AXI-040ES3. These represent ES2 and ES3 respecively.

Then choose the appropriate device from Project > Device Selector.



Re: Coding For PSOC creator

Gautam Das posted on 09 Feb 2012 09:17 PM PST
Cypress Employee
742 Forum Posts

Regarding the working of the project, some of the points to consider are:

1) Is the jumper J11 (VR_PWR) placed? Placing this jumper will power the potentiometer which you can use to change the voltage to be measured. Connect VR to the analog pin with is fed to the ADC.

2) Jumper J10 (RS232_PWR) should be placed when you are using the DB9 connector and MAX232 (for RS232) available on kit.

3) Make sure that the RX and Tx pins in project is connected to the Rx and Tx available on board using jumper wires. The connection of Rx and Tx should be criss-crossed with PC's DB9 pin. That is, Rx should be connected to Tx and Vice versa. If you are not sure about this, try reversing the Rx-Tx combination and see if you can see the output on Hyperterminal.

4) The baud rate, Flow Control and number of Stop bits set in Hyperterminal should be in accordance with the UART Component configuration used.

 

It will be easier for us to help you figure out the issue if you can upload the project here.



Re: Coding For PSOC creator

neha posted on 09 Feb 2012 09:29 PM PST
Top Contributor
85 Forum Posts

The device selected is right. I've verified .Project taken is example project.Then why is'nt it working?

I rebuilt the example projects with few modifications in configuration of components, a part of where counts are reported to lcd propotional to voltage through potentiometer is working, RS-232 still not sending data to hyperterminal!



Re: Coding For PSOC creator

neha posted on 09 Feb 2012 09:37 PM PST
Top Contributor
85 Forum Posts

here's the attachment



Re: Coding For PSOC creator

Bob Marlowe posted on 10 Feb 2012 01:02 AM PST
Top Contributor
1768 Forum Posts

At first sight, everything seems to be alright with your UART-Tx. I would suggest to connect a scope (or an internal counter) to the Tx output to verify it's running. Probably something with the PC -connection doesn't work: Levels +- 12V or the cable (Rx-Tx crossed) are not as required.

You haven't enabled the global interrupts (which are not required yet for UART, but do not forget it later!!) Enabling would not disturb the usual function of the device.

 

Bob



Re: Coding For PSOC creator

Gautam Das posted on 12 Feb 2012 06:39 AM PST
Cypress Employee
742 Forum Posts

I tested the project at my end on CY8CKIT-001 PSoC3 production Silicon.

The update of raw counts on LCD is fine.

The Hex values are also displayed on the Hyperterminal.

The LED blinks at a rate depending on the input voltage from the pot. Higher the voltage, slower is the blinking rate.

 

Please make sure that you have connected P1[2] to Tx Pin on the header section just below the RESET button and the RS232_PWR jumper is placed. I used a USB-UART converter while testing it on my laptop.



Re: Coding For PSOC creator

Gautam Das posted on 12 Feb 2012 06:43 AM PST
Cypress Employee
742 Forum Posts

A snap-shot of the development kit with an external USB-UART converter is attached along with this comment.



Re: Coding For PSOC creator

Gautam Das posted on 12 Feb 2012 06:47 AM PST
Cypress Employee
742 Forum Posts

The Hyperterminal configuration and reading snap-shots are attached. Hope this helps.



Re: Coding For PSOC creator

neha posted on 13 Feb 2012 03:25 AM PST
Top Contributor
85 Forum Posts

Thnx Guys!!!

Am gettin data on UART, thnx a ton!

js 1 issue dat lcd showing ' vcount' till 259 instead of 256. 



Re: Coding For PSOC creator

neha posted on 21 Feb 2012 11:19 PM PST
Top Contributor
85 Forum Posts

Hi dasq!

refereing to your post on posted on 10 Jan 2012 12:56 AM PST ,the project file given as under, i should use a comparator at the input of counter.The pulses i need to count are tail pulses. But the output of comparator is analog! it shows an error of type mismatch. please see the modified diagram..

 

 



Re: Coding For PSOC creator

Gautam Das posted on 21 Feb 2012 01:27 AM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

You are getting this error because you have use an OpAmp instead of comparator. The output of an OpAmp should be analog.

Replace it with a Comparator, and the design will build fine. The inputs of a comparator are analog and the output is digital.



Re: Coding For PSOC creator

neha posted on 29 Feb 2012 03:37 AM PST
Top Contributor
85 Forum Posts

HI dasq!

thanks for previous post! Before checking for countinig of Tail Pulses i just want to see if LV TTL pulses(~3V) are counted for frequency. Should i directly burn the project given by u in 10 Jan 2012 12:56 AM PST post called Counter_frequency measurement? It requires digital input at pin P0[2] . is it still necessary that i use comparator at input?



Re: Coding For PSOC creator

Gautam Das posted on 29 Feb 2012 05:01 AM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

If the external signal whose pulses you are suppposed to count is digital (0V - 3.3V), then you can straight away use the project. The input signal should be connected to P0[2].

If the signal is not digital and a comparison has to be made with respect to some threshold, then a comparator has to be used as suggested previously in the post I made on 05 Jan 2012 at 02:41 AM PST.

 

What is the source of pulse you are intending to count?



Re: Coding For PSOC creator

neha posted on 29 Feb 2012 05:07 AM PST
Top Contributor
85 Forum Posts

I've tried to measure frequency of nearly 1KHz from a function generator TTL pulses through aforementioned project. What is expected on LCD display is

'FREQUENCY

00000400 Hz'

that nearly coressponds to 1.024 KHz

as per the program

But the observation is nearly 0010 46XX to 0010 55XX Hz   (last 2 bytes varying too fast to observe!)

The frequency is perfectly '0000 0000' Hz in the absence of input. Vdd is selected to 3.3V on the kit. Programming is shown as a success and device ready to use.

What could be the problem? i tried to watch this variable in local window when Debugged after selecting the target. It shows 0x00000000.

                                         



Re: Coding For PSOC creator

hexus posted on 29 Feb 2012 06:11 AM PST
Top Contributor
31 Forum Posts

Try to use this one for measuring the frequency. It's looks worked, I use them on my PSoC3 DK for calibration an other devices.



Re: Coding For PSOC creator

hexus posted on 29 Feb 2012 06:12 AM PST
Top Contributor
31 Forum Posts

Hm. Forget to upload source, again :D



Re: Coding For PSOC creator

hexus posted on 29 Feb 2012 06:16 AM PST
Top Contributor
31 Forum Posts

Hm. Not forget, but it not appear with message...

 

There is the link to source.

https://rapidshare.com/files/464032718/FreqCounter3.cyprj.Archive02.zip



Re: Coding For PSOC creator

neha posted on 01 Mar 2012 11:26 PM PST
Top Contributor
85 Forum Posts

@dasq

I've used Function generator 1016 Systronics make. Before giving it to the input pin P0[2] i've tested it on scope for frequency nearly 1Khz (+/- 1%) and Vp-p 3V nearly( not more!).

Reconducting same measurement gave readings varying from '0010 69XX' to '0010 3BXX'  ,reducing steadily over time in the half an hour i observed it.



Re: Coding For PSOC creator

neha posted on 01 Mar 2012 11:30 PM PST
Top Contributor
85 Forum Posts

@hexus!

Hi! Am unable to open the file from Rapid Share.The message is

'Download not available

The following download is not available:

just see If u can attach this file to your message .



Re: Coding For PSOC creator

Gautam Das posted on 01 Mar 2012 10:53 AM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

I just now tested the project  which was posted by me on 05 Jan 2012 at 02:41 AM PST by feeding a square wave from a function generator to pin P0[2].

 

When I fed 1kHz square wave, the reading on char LCD was 0x3F2 (1010d).

When 10kHz square wave was fed, the reading was 0x2760 (10080d).

 

The slight deviation from expected result can be attributed to:

1) The tolerance of IMO.

2) The small duration of the measurement window (100ms).

3) The tolerance of the signal generator itself.



Re: Coding For PSOC creator

Gautam Das posted on 01 Mar 2012 11:02 AM PST
Cypress Employee
742 Forum Posts

However, the large deviation which you see in the result at your end indicates that something is not right.

May be you are missing out something trivial.

 

Try looking into the following:

1) The input from function generator should be square (using sine will give wrong result because of the constituent harmonics).

2) Make sure that there is a common ground between the signal generator and the PSoC development kit.

3) Try changing the digital input pin to some other in .cydwr and then feed the square wave to this input.

 

Let us know if this works.



Re: Coding For PSOC creator

neha posted on 02 Mar 2012 12:12 AM PST
Top Contributor
85 Forum Posts

Hi dasq!

I've watched the reading over a period of time. It becomes 1 KHz (~0x442) but that too after an unacceptable delay of 30 minutes decrementing from starting reading of nearly 0010 69XX Hz!! Morever, it is unable to linearly track frequency- same instability issues! 

Kindly attach the zip file of project where u have used comaparator at input (post on 5 jan, 2:41 pm).I'll burn it on my device straightaway and see if there are any issues with hardware for same schematic.



Re: Coding For PSOC creator

Gautam Das posted on 02 Mar 2012 12:27 AM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

The project which I tested yesterday was the one I had posted on 10 Jan 2012 12:56 AM PST.

You just need to add a comparator and a VDAC with appropriate voltage setting. In main.c, all you have to write is 2 extra lines of APIs to start these two components.



Re: Coding For PSOC creator

Gautam Das posted on 02 Mar 2012 01:04 AM PST
Cypress Employee
742 Forum Posts

Comparator is added and VDAC is set to 1000mV.

P0[2] is configured as an analog pin.

 

I have attached the project, let's see if this gives you the expected reading.



Re: Coding For PSOC creator

neha posted on 02 Mar 2012 03:49 AM PST
Top Contributor
85 Forum Posts

hey thnx dasq!!

i made the design schematic with comparator, bt thr ws sm error in linking while build :(

thnx again :))



Re: Coding For PSOC creator

Gautam Das posted on 02 Mar 2012 04:38 AM PST
Cypress Employee
742 Forum Posts

You can modify the project on the similar lines as the project attached in my previous post.

All the best !



Re: Coding For PSOC creator

neha posted on 13 Mar 2012 03:45 AM PST
Top Contributor
85 Forum Posts

Hi!

got this error while burning previous project

Error: dbg.M0033: The selected debug target 'CY8C3866AXI-040ES2' is not compatible with the project's selected device 'CY8C3866AXI-040'.



Re: Coding For PSOC creator

Bob Marlowe posted on 13 Mar 2012 05:07 AM PST
Top Contributor
1768 Forum Posts

Left click (on the right-hand side in the workspace explorer) on the Project, then click on "Device selector..." and chose the correct device (without the ES2).

 

Happy programming

Bob



Re: Coding For PSOC creator

Gautam Das posted on 13 Mar 2012 10:26 AM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

Please make sure that the PSoC3 device you are using is same as the device selected in the project. As Bob has already mentioned, you can select the appropriate device from the "Device Selector" tab.

You can find the version of your PSoC 3 device by just looking onto the name on the chip. If it is "CY8C3866AXI-040ES2", then you'll have to change the device to this number in the project, build the project and program it.



Re: Coding For PSOC creator

neha posted on 15 Mar 2012 10:05 PM PST
Top Contributor
85 Forum Posts

Hi!

whats the difference between .cyprj and .cywrk files. I saved a schematic yesterday by clicking 'save' icon (as well as' save all') in the menu and then closed the creator window. It was seen as a .cyprj file when opened today  and sadly entire schematic was blank!!!!!



Re: Coding For PSOC creator

neha posted on 15 Mar 2012 10:14 PM PST
Top Contributor
85 Forum Posts

Sorry! found it...please omit OP..

 



Re: Coding For PSOC creator

neha posted on 15 Mar 2012 10:35 PM PST
Top Contributor
85 Forum Posts

Hi!

the device selected is same as used!. I've manually done it through device selector as well!

stilll the same error ...i've burnt previous program on it with same settings!!!



Re: Coding For PSOC creator

Gautam Das posted on 15 Mar 2012 11:16 PM PST
Cypress Employee
742 Forum Posts

neha,

 

So, is the device you are using CY8C3866AXI-040ES2?

Did you try programming the device using "PSoC Programmer"?



Re: Coding For PSOC creator

neha posted on 20 Mar 2012 01:16 AM PST
Top Contributor
85 Forum Posts

Hi !

I did reset the system closed the window and restarted creator and reprogrammed with manual selection of silicon. It was fine then.

Did not use the programmer .  where is the hex file made ?? I dint find it in the folder made for project.

Thnx!!



Re: Coding For PSOC creator

srim posted on 20 Mar 2012 01:37 AM PST
Cypress Employee
121 Forum Posts

 Hi,

The hex file can be found at

1) <Proj_Folder>\<Proj_name.cydsn>\<DP8051> \<DP8051_Keil_903>\<Release>or<Debug> for PSoC3

2)<Proj_Folder>\<Proj_name.cydsn>\<CortexM3> \<ARM_GCC_441>\<Release>or<Debug> for PSoC5

 



Re: Coding For PSOC creator

srim posted on 20 Mar 2012 01:40 AM PST
Cypress Employee
121 Forum Posts

Another method is to click results tab in creator --> double click .hex file and right click on the hex tab in schematic and choose "open containing folder"



Re: Coding For PSOC creator

neha posted on 20 Mar 2012 05:52 AM PST
Top Contributor
85 Forum Posts

THNX!!



Re: Coding For PSOC creator

neha posted on 28 Mar 2012 12:26 AM PST
Top Contributor
85 Forum Posts

Hi dasq!

Few doubts in the coding of project (posted on 2 Mar, 2012, 1:04 AM PST by dasq)

>  the interrupt flag 'compare_occured' has been raised in file 'ISR_1.c' Which is a part of generated source that appears after building the project. How did u write into its subroutine  when this file was not seen in workspace at the time of designing? I wish to do same for an RTC interrupt, how to acess its interrupt service routine?
 
> the 'compare mode' option of the counter has been set to mode 'software option' and compare value to 255. Although I have seen the datasheet am unable to understand that if i've to preclude frequencies below 255 hz to be counted ( or nearly 50ms or longer duration pulses), why should'nt option 'Greator than' be used? or is it serving some other function?



Re: Coding For PSOC creator

srim posted on 28 Mar 2012 12:49 AM PST
Cypress Employee
121 Forum Posts

 Hi neha,

you can only write to the isr_1.c file after building the file for the first time. Also, you need to write for each device as the generated files are different for diff devices. This is one of the disadvantges of writing in the generated routines. Thats why its advised to implement your own isr routines in main.c or user .c files.

 



Re: Coding For PSOC creator

neha posted on 28 Mar 2012 04:42 AM PST
Top Contributor
85 Forum Posts

Hi Srim!

thnx, So how do i write interrupt routine of RTC or ISR component in main.c?? I mean in which function???



Re: Coding For PSOC creator

Bob Marlowe posted on 28 Mar 2012 06:34 AM PST
Top Contributor
1768 Forum Posts

I always use a different approach, so I do not have to fumble in the generated c-files.

I use

   Isr_StartEx(MyRoutine);

where

CY_ISR_PROTO(MyRoutine); // Declaration

CY_ISR(MyRoutine) // Definition

{

   // Code goes here

}

Look at "System reference guide" Pg 9

Happy coding

Bob



Re: Coding For PSOC creator

srim posted on 28 Mar 2012 07:58 AM PST
Cypress Employee
121 Forum Posts

 Hi neha,

If you have time, please go through Application note AN54460 for more details on interrupts :)



Re: Coding For PSOC creator

srim posted on 28 Mar 2012 08:04 AM PST
Cypress Employee
121 Forum Posts

 Here is the link !

http://www.cypress.com/?rID=38267



Re: Coding For PSOC creator

Gautam Das posted on 31 Mar 2012 10:56 AM PST
Cypress Employee
742 Forum Posts

neha,

 

1) The flag "compare_occurred" is set in the ISR. This code was written after building the project and generating the ISR code. Writing the statements between the `#START and `#END will ensure that those lines are not cleared upon Clean and Build as the ISR code is regenerated.

You can follow another method, of writing the ISR code in the main.c file as suggested by Bob and SRIM.

 

2) In this project, the compare_mode has no significance. The counter is configured such that Interrupt occurs "On Capture". Compare is not used for anything, hence what number you write to it is immaterial. Software Controllerd compare mode indicates that the user can choose any of the 5 compare modes, during run time using the API Counter_SetCompareMode(). In this project, the compare feature is not utilized.



Re: Coding For PSOC creator

neha posted on 04 Apr 2012 03:03 AM PST
Top Contributor
85 Forum Posts

HI!

thnx for suggestions.

I have modified counter frequency mesurement project  slightly to display 16 bit cps in decimal on LCD. kindly see the zip file. Actually the project is built successfully but when burnt there's no display. Am i missing anything? Js see the project



Re: Coding For PSOC creator

neha posted on 04 Apr 2012 03:06 AM PST
Top Contributor
85 Forum Posts


Re: Coding For PSOC creator

neha posted on 04 Apr 2012 03:08 AM PST
Top Contributor
85 Forum Posts


Re: Coding For PSOC creator

srim posted on 04 Apr 2012 04:19 AM PST
Cypress Employee
121 Forum Posts

 Hi neha,

Please assign the LCD pins to port 2 [6:0]. you should be able to see your results.

 

thanks,

srim 



Re: Coding For PSOC creator

neha posted on 11 Apr 2012 05:09 AM PST
Top Contributor
85 Forum Posts

Hi!

Facing some stability issues with counting of the pulses.The counts are not consolidated that is the values are well + 100 to 150 cps. 200Khz is reported between 300-400cps.1 Khz is shown as stable a value between 1 to 100 Hz( could be ripple noise). CPS is updated so fast such that its unreadable.

Am using "LCD_PrintNumber(uint16value)" function to get display in decimal. The format is:

CPS

xxxx     Hz

a 16 bit value can be a maximum of 1111111111111111 in binary that is 655535 in decimal, but what is seen is just a 3 digit display.  why is a garbage count displayed when if frequency is switched to 1K? I've tested the pulse generator with a CRO before connecting  it to the input pin. The frequency is consolidated.

 



Re: Coding For PSOC creator

Bob Marlowe posted on 11 Apr 2012 06:26 AM PST
Top Contributor
1768 Forum Posts

Hi, you could tune your comparator a bit: enable hysteresis and speed set to fast.

The DAC-value is set to 500mV, that is ok, when the input-signal is 0 to 1V otherwise I would select something near the half the maximum of the input-signal.

So (I hope) you will get rid of ripple.

Ah, and: leave at least a space between your Number and "Hz" (LCD_Position(1,6)).

 

Bob



Re: Coding For PSOC creator

neha posted on 13 Apr 2012 12:12 AM PST
Top Contributor
85 Forum Posts

thnx bob, Srim

i've shifted the "Hz" string to position (1,9) on lcd.

The display being updated too fast to judge about accuracy of measurement, so  want to use per second interrupt stub of RTC to update lcd display in the above project.Am starting a separate thread for RTC, kindly follow http://www.cypress.com/?app=forum&id=2232&rID=61951.

thnx again :)

Neha



Re: Coding For PSOC creator

Bob Marlowe posted on 13 Apr 2012 12:45 AM PST
Top Contributor
1768 Forum Posts

When in need of a periodic interrupt, it must not be the RTC, a simple timer-module would do the job as well. If you would like to play around with the RTC... OK.

 

To use a timer-interrupt, drop a 16-bit timer on your schematic, see attached project

 

Happy testing

Bob



Re: Coding For PSOC creator

neha posted on 26 Apr 2012 11:02 PM PST
Top Contributor
85 Forum Posts

Thnx Bob!!!

I accomodated the timer module in this projact and display is updated fine per second...:))

 



Re: Coding For PSOC creator

neha posted on 26 Apr 2012 11:05 PM PST
Top Contributor
85 Forum Posts

But the problem of inaccurate counting still persists. As per your suggestion, hysteresis has been enabled and transition made to 'fast'. Also the duration of PWM has been increased.

Can anyone test this project for accuracy of counting and bring out the issues?



Re: Coding For PSOC creator

neha posted on 26 Apr 2012 11:40 PM PST
Top Contributor
85 Forum Posts


Re: Coding For PSOC creator

neha posted on 26 Apr 2012 11:43 PM PST
Top Contributor
85 Forum Posts


Re: Coding For PSOC creator

Bob Marlowe posted on 26 Apr 2012 12:38 AM PST
Top Contributor
1768 Forum Posts

Neha,

you are still using a PSoC3 with silicon ES2. Cypress will exchange your board / processor-module to latest version just for the shipping costs. Look here http://www.cypress.com/?rID=61994&source=home_cdc

There is an error in the ES2 concerning interrupts and Cypress suggests to connect the Isr-module not to the interrupt-pin but to the comp / tc output which will not work in your case (you need a capture interrupt).

I'll dig a bit to find a hardware solution I think there was one I've seen.

 

Stay tuned

Bob



Re: Coding For PSOC creator

Bob Marlowe posted on 26 Apr 2012 10:33 AM PST
Top Contributor
1768 Forum Posts

I removed the interrupt from the counter and now polled for the capture. I do not have an ES2 chip in my Kit, so the modifications are untested.

 

Give it a try

Bob



Re: Coding For PSOC creator

neha posted on 27 Apr 2012 05:30 AM PST
Top Contributor
85 Forum Posts

Bob,

Problem not rectified :(.

For an input frequency of 200Hz (sharp!) the counts reported vary from 140 to 900 CPS.

When the input signal is removed, it takes about 5 to 10 seconds for counts to settle to a small value( that too not 0 but somewhere near 50 CPS)

At 1 kHz the CPS reported is a fixed value between 0 to 100 CPS...which should be seen as 1000 CPS.

 



Re: Coding For PSOC creator

Bob Marlowe posted on 27 Apr 2012 01:36 PM PST
Top Contributor
1768 Forum Posts

The clocks needed to be synchronized, there where two warnings which I overlooked before.

The frequency-calculation had busted the 65536-limit, so I used a float.

 

Bob



Re: Coding For PSOC creator

neha posted on 30 Apr 2012 05:30 AM PST
Top Contributor
85 Forum Posts

Thnx Bob,

But its nt working yet. In absence of input also it is reporting some value ranging from 120 to 900 cps instead of coming down to 0.



Re: Coding For PSOC creator

Bob Marlowe posted on 30 Apr 2012 09:00 AM PST
Top Contributor
1768 Forum Posts

Well, Neha;  so you'll have to check your math again:

The counter is reloaded (with zero) at every capture and starts to count up with your count-input.

When no count pulse came, but the capture signal then the value is still zero. Now look at your line to calculate frequency... that makes.........

I would suggest to discard count-values which are < 5 or similar, because they may not count exact enough and display an appropiate message on LCD.

For counting lower frequencies it can be better to enlargen the period between two captures.

Do you use a Kit001 with PSoC3 procwessor module? If so, I have an interesting exercise for you: Generate an internal frequency (derived from 32kHz-X-tal) and count that (as a calibrating or self-test) When a switch is pressed, change to measure from the exterrnal input. Display the input-source on LCD.

 

Bob

 

 



Re: Coding For PSOC creator

Bob Marlowe posted on 02 May 2012 02:23 AM PST
Top Contributor
1768 Forum Posts

The awkward behavior of the frequency display when there is no input connected results from to different facts: due to the high impendance of the (High-Z) input stray voltages from the power net and capacitances of the input path will lead to false triggerings of the counter as long as the input is open.

To avoid this, you may pull-down (or pull-up) the input with a resistor to GND (VCC) with the cost of some load in the input-signal and a resistor. You can save the resistor and test your equpment against open input by defining your input pin a bit different:

In the configuration dialog

set Type to "Analog" AND "Digital Output" with NO "HW Connection" (uncheck the box)

under the "General" tab select "Drive Mode" as "Resistive pull-up" Initial State High or

"Resistive pull-down" and state Low.

I did not try yet  "Resistive pull up/down" but that should work as well.

 

Happy pulling

Bob 



Re: Coding For PSOC creator

neha posted on 19 Jun 2012 04:12 AM PST
Top Contributor
85 Forum Posts

Hi!!

made this simple project for end around counting of digital pulses through PWM. The counter is much stable now, some small inaccuracy of about 1 count lesser in 10 second of counting .... that is the value that ideally should remain 4 becomes 3 once in 10 seconds of reporting.Toggling of LED_2 is redundant...js to keep track of seconds.

 



Re: Coding For PSOC creator

danaaknight posted on 19 Jun 2012 04:57 AM PST
Top Contributor
1773 Forum Posts

This might be of assitance, attached.

 

Regards, Dana.

 

 



Re: Coding For PSOC creator

Gautam Das posted on 21 Jun 2012 12:29 AM PST
Cypress Employee
742 Forum Posts

Hi Neha,

 

I didn't understand reason for the presence of 1KHz clock on the Capture input.

The frequency of the capture signal should be less than the Count signal to allow increment / decrement in the counter value between two captures.



Re: Coding For PSOC creator

neha posted on 21 Jun 2012 02:00 AM PST
Top Contributor
85 Forum Posts

Hi dasq!

 the frequency source is 1 KHz ILO but the frequency applied at capture is 1 Hz actually. This makes reporting of 'Counts per Second' value easier without any computation required in the program.



Re: Coding For PSOC creator

Gautam Das posted on 21 Jun 2012 08:23 AM PST
Cypress Employee
742 Forum Posts

Hi Neha,

 

These are the of modifications I did to your project:

 

1) In the counter, the "Clock Mode" is set to Up Counter. The "Reload Counter" is set to "On Capture".

2) The "Capture Mode" is set to "Rising Edge".

3) The Capture signal is set to 1Hz by using the 1KHz clock with a divider of 1000.

4) The ISR routine is written in the "counter_isr.c" file. Hence, counter_isr_Start( ) API is called in the main( )  function.

5) There is no need of introducing 1000ms delay in the for( ) loop. The Capture signal is 1Hz clock.

6) The Counter is started first and then the PWM. If PWM is started before Counter, then it will miss the first count and will hence display one count less in the first capture. The subsequent captures will be normal.

 

Try this project wiith different values of PWM period. The output should be as expected.

 

Regards,

Gautam Das



Re: Coding For PSOC creator

Gautam Das posted on 21 Jun 2012 08:32 AM PST
Cypress Employee
742 Forum Posts

The project is attached along with this post.



Re: Coding For PSOC creator

neha posted on 25 Jun 2012 02:16 AM PST
Top Contributor
85 Forum Posts

Thnx Gautam!

The count was much stable now. I extended this approach for counting pulses in a single voltage window. The same problem of instability persists

> the counts reported in the duration of 1s using a frequency generator at 20Hz, 200Hz and 1Khz are unstable.The reading is updated on LCD per second. 3 out of 5 are completely out of measurement (reporting 9000 something for 1K frequency!)

> A test clock and pin provided on the design (see attached peoject) as a source of frequency separately. It counts nearly 600 hz more than expected frequency.I've tested it with various clocks and dividers.

Plz burn this project if u hv CY8C001. connect P1[6] to P1[7] and see the counts on LCD. 

Thnx in advance

Neha  



Re: Coding For PSOC creator

Bob Marlowe posted on 25 Jun 2012 04:11 AM PST
Top Contributor
1768 Forum Posts

Some instabilities will result from ignoring a warning from the build-stage. You are using different clocks (IMO and ILO) which are concidered to be asynchroneous. A Synchronizer MUST be used.

The interrupt is NOT "rising edge" as suggested but "derived".

As far as I remember some time ago I made the suggestion NOT to use Isr_Start() but Isr_StartEx(MyIntRoutine). There are reasons for that. Mainly the switching to a different device (PSoC5) will need again work in a generated file to be done. The Isr_StartEx scheme will avoid that and has additionally the advantage that the Isr is kept in main.c and can be viewed and altered easily.

The loop in the main() has two identical branches which will update the LCD when the status_flag is set and when it is not set. the latter should be avoided, so that the update only occurs when a capture has occured.

Some thought for a critical application should be made here: what if the interrupt occurs just within the fetching of the (two-byte) count_val? Here an invalid value might be processed which will not be critical here because it is only shown on the LCD, but think of a medical device or a part in an airplane: something rather ugly MIGHT happen. To avoid conflicts like that there is an EnterCriticalSection and an ExitCriticalSection which will prevent the system from accepting interrupts between.

 

Bob



Re: Coding For PSOC creator

neha posted on 26 Jun 2012 05:18 AM PST
Top Contributor
85 Forum Posts

Hi Bob!

Thnx fr replyn. I already checked it by changing the interrupt to 'RISING EDGE' than 'DERIVED'.Maybe that is missing in attached project.

As per your suggestion ,I've also modified this project  and tested StartEx(My_ISR) instead of  Start()  in main (based on project attached in OP 19 Jun 2012 04:12 AM PST).There's no evident change in accuracy. The counter would be deployed to count some external pulses so i didn't synchronise clock_test and clock_counter.

Hw to prevent the conflict if the interrupt occurrs when count_val is fetched? can you help with the use of EnterCriticalSection and ExitCriticalSection functions? Not familiar with this..

Neha

 



Re: Coding For PSOC creator

Bob Marlowe posted on 26 Jun 2012 05:54 AM PST
Top Contributor
1768 Forum Posts

Hi Neha,

have a look into the System Reference Guide chapter 12 (System Functions) to be found in

Creator 2.0 Help -> Documentation -> System Reference -> System Reference Guide.

This manual contains a lot of supplemental informations.

Changing an interrupt from using Isr_Start() to Isr_StartEx(MyFunction) will not change any behaveour at all. But the Interrupt function now becomes visible becaus it is located in main.c and not buried deep within the generated files you normally do not look at. By the way: the CY_ISR and CY_ISR_PROTO explanations are in the same manual.

 

From your post I cannot see whether you put a sync-module between your clock and the count-input and whether it improved the performance of counting.

 

Bob



Coding For PSOC creator

vgy posted on 27 Jun 2012 11:35 PM PST
Top Contributor
133 Forum Posts

 hi to all, i am new new to the psoc creater, can any one help me with  TOP DESIGN OF blood pressure monitor system .



Re: Coding For PSOC creator

Bob Marlowe posted on 27 Jun 2012 01:09 AM PST
Top Contributor
1768 Forum Posts

Welcome in the fascinating world of PSoC!

One approach would be to enter "blood pressure" in the "Keyword Search"-field at the very top of this (lengthy) thread. When there are still any questions, do not hesitate to ask for.

 

Bob



Re: Coding For PSOC creator

danaaknight posted on 27 Jun 2012 02:52 AM PST
Top Contributor
1773 Forum Posts

Ap note on BP monitor (PSOC 1) -

 

http://www.eetkorea.com/STATIC/PDF/201005/EEKOL_2010MAY31_TPA_AN_01.pdf?SOURCES=DOWNLOAD

 

Regards, Dana.



Re: Coding For PSOC creator

Gautam Das posted on 28 Jun 2012 10:00 PM PST
Cypress Employee
742 Forum Posts

Hi psocrajendra,

 

A document on Blood Pressure monitor using PSoC3/5 is attached along with this comment.

You can also view a demo video at http://www.cypress.com/?rID=43533



Re: Coding For PSOC creator

Gautam Das posted on 28 Jun 2012 11:06 PM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

I tested the project Single_Channel_Analysis.zip which you had uploaded on 25 Jun 2012 02:16 AM PST.

When P1[6] and P1[7] are connected, the CPS value on LCD was around 6100Hz and it was consistent. This is as expected.

 

From the schematic, what I observed is that the "Count" signal will be of frequency twice the "Signal Input" which was 3000Hz.

 

The difference in threshold set by the VDAC (500mV and 2500mv) created a narrow pulse at the AND Gate's output during Rising and Falling of the Signal Input (which is 3000Hz). Hence two pulses will result in one period. Count of ~6100Hz confirms this fact.

 

Is that how the project was intended to work?



Re: Coding For PSOC creator

neha posted on 29 Jun 2012 03:50 AM PST
Top Contributor
85 Forum Posts

Hi Gautam!

Are u sure u are getting 6100Hz? did u modify anything?  I am getting a consistent 3267-3269 Hz burning same project.

The project is intended to count the input frequency as it is. All the pulses in the voltage window should be counted, rest all should be discarded. Did u attenuate the amplitude of test frequency signal? and did u burnt it on CY8C001 kit?

Neha

 



Re: Coding For PSOC creator

Bob Marlowe posted on 29 Jun 2012 06:11 AM PST
Top Contributor
1768 Forum Posts

Are you both using the same silicon revision?

Bob



Re: Coding For PSOC creator

danaaknight posted on 30 Jun 2012 06:51 PM PST
Top Contributor
1773 Forum Posts

The attached ap notes from HP cover basic counting methods and errors, thought

they might be useful.

 

Regards, Dana.



Re: Coding For PSOC creator

Gautam Das posted on 01 Jul 2012 11:48 PM PST
Cypress Employee
742 Forum Posts

Hi neha,

 

I got readings of approximately 6100Hz. The project was tested as it is, without any modification on PSoC 3 production Silicon on CY8CKIT-001.

I didn't attenuate the amplitude of the input signal. It toggles between Vss and Vdd since it is a digital signal.

By looking at your statement, seems like you are trying to implement something like a WIndow Comparator. and you want to measure signals only within a specified window.

And you are using PSoC 3 ES2 silicon.

 

Thanks danaaknight for sharing the app notes.



Re: Coding For PSOC creator

neha posted on 02 Jul 2012 04:15 AM PST
Top Contributor
85 Forum Posts

Hi!

I cross checked with another kit , recently procured another CY8C001 kit. From first look it appeared its js same as previous. But the device selector prompted that device not supported. It was burnt only when device was rolled back from CY8C3866AXI-040-ES2 to CY8C3866AXI-040. The same program on this kit reports 7575-7584 counts which was 3264 to 3265 on older kit. Why should the frequency be doubled if capture is on rising edge that occurrs once in a pulse cycle?

  



Re: Coding For PSOC creator

neha posted on 02 Jul 2012 04:46 AM PST
Top Contributor
85 Forum Posts

i've made the window large(48mv to 3.4V), also output taken from P0[2] instead of P1[6].  



Re: Coding For PSOC creator

vgy posted on 05 Jul 2012 01:48 AM PST
Top Contributor
133 Forum Posts

 thank u all for showing me the way



Re: Coding For PSOC creator

sachinbvp posted on 11 Jul 2012 03:28 AM PST
Top Contributor
139 Forum Posts

@neha which kit are using for your projects?

 

direction for psoc:

install psoc creator

learn about hardware from datasheets and kit guide that comes with psoc

take sample code from psoc library first run them and try to learn from them

then go and build your codes



Re: Coding For PSOC creator

neha posted on 27 Jul 2012 11:06 PM PST
Top Contributor
85 Forum Posts

Hi !

 The problem of instability of counts is solved. Using ECO instead of ILO for capture pulses gives gr8 results as far is counting is concerned but here's a different problem now. AM not getting the channel as selected..pulses above LLD(Low Level Discriminator) and below ULD(Upper level Discriminator) should be counted..instead below LLD and above ULD is counted. To verify i made a separate project with just 1 level of discrimination. Taking test pulses of 3K (fixed) and since generated on chip these are not more than 3.4V. Now setting a reference of 4V should not produce any count also GetCompare() value of comparator should remain 00 because input pulses never exeed reference. In the attached project, with any refernce value of VDAC (400mVor 4000mV) am not getting any counts. However, if this VDAC is attached to +ve terminal and signal to negative, am getting all counts at signal....in both cases 'discrimination' is not visible



Re: Coding For PSOC creator

Bob Marlowe posted on 27 Jul 2012 12:54 AM PST
Top Contributor
1768 Forum Posts

Your count frequency is IMO/1000 = 3kHz

Your capture frequency is 32.768kHz

So there is nothing to capture

 

Bob



Re: Coding For PSOC creator

hli posted on 27 Jul 2012 02:05 AM PST
Top Contributor
675 Forum Posts

@neha: if you want to look at another solution for frequency measurement: www.cypress.com/



Re: Coding For PSOC creator

danaaknight posted on 27 Jul 2012 02:54 AM PST
Top Contributor
1773 Forum Posts

I see your capture rate is 1 Hz.

 

You forgot to start a clock,

 

Clock_Test_Start();

 

Regards, Dana.



Re: Coding For PSOC creator

danaaknight posted on 27 Jul 2012 03:14 AM PST
Top Contributor
1773 Forum Posts

This clock also did not get started -

 

Clock_capture_2_Start();

 

 

Regards, Dana.



Re: Coding For PSOC creator

neha posted on 27 Jul 2012 03:15 AM PST
Top Contributor
85 Forum Posts

@Bob

i/p frequency is 3K. Capture frequency is 32.768K/32768= 1Hz. so there are 3000 pulses to count in 1 sec. 



Re: Coding For PSOC creator

neha posted on 27 Jul 2012 03:17 AM PST
Top Contributor
85 Forum Posts

@danaa

the clocks are marked 'start on reset'. Starting them individually is not required as given in datasheet



Re: Coding For PSOC creator

danaaknight posted on 27 Jul 2012 03:32 AM PST
Top Contributor
1773 Forum Posts

You config counter as UP, inititate it with full count, so on next pulse it generates Tc and reloads

itself with full count. You should config as down, when capture performed subtract that from

65,535

 

Regards, Dana.

 



Re: Coding For PSOC creator

neha posted on 27 Jul 2012 04:48 AM PST
Top Contributor
85 Forum Posts

Thnx evry1,

this should work in a voltage window ...conceptually i dont see any fault. and yes as suggested clocks have been started using APIs. To see where the error is am seeing GetCompare value of both discriminators. i'll post modified project. Js see if anything else is missing.

Regards

Neha

 



Re: Coding For PSOC creator

neha posted on 03 Aug 2012 02:02 AM PST
Top Contributor
85 Forum Posts

Js for test...i thresholded only with a single level( Lower Level threshold). Ideally there should be 0 CPS once this value is set to anything greator than 3.3V for test pulses from a clock..but it counts full frequency..irrespective of threshold set. 



Re: Coding For PSOC creator

neha posted on 03 Aug 2012 02:03 AM PST
Top Contributor
85 Forum Posts


Re: Coding For PSOC creator

neha posted on 03 Aug 2012 02:04 AM PST
Top Contributor
85 Forum Posts


Re: Coding For PSOC creator

danaaknight posted on 03 Aug 2012 03:14 AM PST
Top Contributor
1773 Forum Posts

With the currrent settings you have, VDAC = 4.080 V, there never

is a "count" + edge to the counter, so every capture returns 65535,

right ?

 

LCD row 0 you always display the compare value of 32767, that will

never change, right ? Unless you write the compare register with a new value.

On LCD row 1 you always write a 0, since your capture register always returns

a 65535.....

 

As an aside, does not seem you are using compare functionality for any reason ?

 

The supply to the part is 5V correct ? Reason I ask is there is a note

in specs at high power the comparator does NOT have common mode

to the rail, and if CM is violated we do not know if there is phase reversal

on its output, unless of course in this case you look at it and observe there

is phase reversal.

 

Regards, Dana.



Re: Coding For PSOC creator

danaaknight posted on 03 Aug 2012 03:25 AM PST
Top Contributor
1773 Forum Posts

With respect to phase reversal, that problem would exist if you are

inputing 3.4V pulses, but Vdd is 3.3V. And of course VDAC output

would be ~ 3.3V in that case. So point was to make sure your dev

board is running at 5V, as called out in your project settings.

 

One additional, I would advise hyterisisi be turned on in the comparator,

its only 10 mV, and helps reject the effects of noise on you input, especially

when inoput ius around VDAC setting.

 

Lastly Vdda is < 6 V, for 5V chip Vdd.

 

Regards, Dana.

 



Re: Coding For PSOC creator

neha posted on 06 Aug 2012 12:25 AM PST
Top Contributor
85 Forum Posts

Hi danaa!

Thanks, you were absolutely right in diagnosing supply voltage flaw.. it was set to 3.3V while it should be set to5V.

I have changed it to 5V. Also hysteresis has been enabled and speed of VDAC set to 'High speed'.

If there is a change in polarity of comparator output, should'nt it be rectified by changing the mode to inverting? The

status is that the count per second value remains 0 either the VDAC value is  400mV or 4000mV (4V).However the Get_compare() value of Comparator is non-zero when threshold is 400mV and zero when threshold is 4V which is as expected if reference voltage is given on inverting terminal. Changing the polarity of comparator is giving no change.

 

Compare value of counter is not used here, i've casually set it to middle of the counter period just to test if the counts cross

mid value any time through a test output pin and LED if required.

Thnx in advance

Regards

Neha.



Re: Coding For PSOC creator

vgy posted on 14 Aug 2012 02:08 AM PST
Top Contributor
133 Forum Posts

 hi 

  can i get help on idea of implementing pulse oximeter and Glucose measurement



Re: Coding For PSOC creator

danaaknight posted on 14 Aug 2012 03:50 AM PST
Top Contributor
1773 Forum Posts

The comparator polarity reversal I was referring to occurs on some

OpAmps and Comparitors if an input is driven outisde its specified

common mode input range. You would not swap input polarity to

remedy that problem, rather you operate inputs within their allowed

common mode range.

 

Regards, Dana.



Re: Coding For PSOC creator

danaaknight posted on 14 Aug 2012 03:58 AM PST
Top Contributor
1773 Forum Posts

Pulse oximeter -

 

http://www.cypress.com/?rid=47829

 

This is for PSOC 1, maybe you could adapt. Apparently this ap note is being re-written.

 

http://www.psocdeveloper.com/uploads/tx_piapappnote/an2313_01.pdf

 

This is code base, PSOC 1, possibly you could adapt.

 

http://www.psocdeveloper.com/forums/viewtopic.php?f=3&t=6968

 

Regards, Dana.



Re: Coding For PSOC creator

vgy posted on 14 Aug 2012 07:16 AM PST
Top Contributor
133 Forum Posts

Sir/Madam

Is it compliance to implement  pulse oximeter and glucose meter  with Psoc 3



Re: Coding For PSOC creator

neha posted on 29 Aug 2012 11:56 PM PST
Top Contributor
85 Forum Posts

Hi Rajendra!

kindly follow http://www.cypress.com/?rID=43800 for demo of glucose meter using precision analog of PSoC 3 on CY8C001 kit.

Also, the notes referenced by Dana have direct relevance. To the best of my knowledge these blocks can be realized 

on PSoC 3.

Regards

Neha.

 



Re: Coding For PSOC creator

vgy posted on 05 Sep 2012 06:12 AM PST
Top Contributor
133 Forum Posts

 

ERROR: Keil License expired. Obtain a valid Keil license and update the information through your installed version of Keil or in PSoC Creator.
WARNING: .\main.c:1: INCORRECT LICENSE ID CODE (LIC) IN 'TOOLS.INI'

Can anybody assist me How to overcome from this problem in Psoc 3 @ Psoc 2.0 Creator

 



Re: Coding For PSOC creator

vgy posted on 05 Sep 2012 06:25 AM PST
Top Contributor
133 Forum Posts

This is the Problem I have Can anbody Help me in this Regard....

------------------------------------------------------------------------------------------------------------------------------------

ERROR: Keil License expired. Obtain a valid Keil license and update the information through your installed version of Keil or in PSoC Creator.
WARNING: .\Generated_Source\PSoC3\cyfitter_cfg.c:1: INCORRECT LICENSE ID CODE (LIC) IN 'TOOLS.INI'
LIBX51.exe TRANSFER '.\DP8051\DP8051_Keil_903\Debug\CyBootAsmKeil.obj', '.\DP8051\DP8051_Keil_903\Debug\CyDmac.obj', '.\DP8051\DP8051_Keil_903\Debug\CyFlash.obj', '.\DP8051\DP8051_Keil_903\Debug\CyLib.obj', '.\DP8051\DP8051_Keil_903\Debug\cymem.obj', '.\DP8051\DP8051_Keil_903\Debug\cyPm.obj', '.\DP8051\DP8051_Keil_903\Debug\CySpc.obj', '.\DP8051\DP8051_Keil_903\Debug\cyutils.obj', '.\DP8051\DP8051_Keil_903\Debug\KeilStart.obj', '.\DP8051\DP8051_Keil_903\Debug\cyfitter_cfg.obj' TO '.\DP8051\DP8051_Keil_903\Debug\firsttttttttttttt.lib'
*** ERROR 210: I/O ERROR ON INPUT FILE:
    EXCEPTION 0021H: PATH OR FILE NOT FOUND
    FILE:    .\DP8051\DP8051_Keil_903\Debug\CyDmac.obj
The command 'LIBX51.exe' failed with exit code '3'.



Re: Coding For PSOC creator

hli posted on 05 Sep 2012 06:50 AM PST
Top Contributor
675 Forum Posts

@psoccrajendra: if you have a new problem, please open a new thread. Otherwise nobody will see your question, and it will get ignored. Also, use the search function - this problem has already be discussed multiple times.



Re: Coding For PSOC creator

srim posted on 05 Sep 2012 08:34 AM PST
Cypress Employee
121 Forum Posts

Hi Rajendra,

This thread might help you. As HLI said, please start a new thread to enable us to track the issues. 

http://www.cypress.com/?app=forum&id=2232&rID=64822

 

Thanks,

srim






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20