Anonymous
Not applicable
Dec 23, 2009
04:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 23, 2009
04:36 AM
Hai,
I am working on AVNET SPARTAN 3A Evaluation KIT.
I just used a 26bit counter code in the FPGA and
I send the MS 3 bits of the counter to the PSoC.
In the PSoC , I just forward the input signal to
the output port.
The input pins of teh PSoC are P2(5), P2(7) and
P4(6) which are connected with the FPGA I/Os.
The output pins of the PSoC are P0(1), P0(3)
and p0(5) , which are connected with the
connector J9.
I am noticing the counter signal at the input
of the PSoC, But not at the Output pins.
I have given the PSoC main.c code below.
If it is required I can give the VHDL code also.
Please help me, to find out the problem
with my code.
Thank You.
Project : PSoC_pin_status.app
==============================
main.c
=======
//----------------------------------------------------------------------------
// This project echos the state of port 2 pin 5 to port0 pin 5
// This project echos the state of port 2 pin 7 to port0 pin 3
// This project echos the state of port 4 pin 6 to port0 pin 1
//
// The status of output ports follow the status of their respective input ports.
//----------------------------------------------------------------------------
#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
void main()
{
while (1) {
if (PRT2DR & 0x20) {
PRT0DR |= 0x20;
}
if (PRT2DR & 0x80) {
PRT0DR |= 0x08;
}
I am working on AVNET SPARTAN 3A Evaluation KIT.
I just used a 26bit counter code in the FPGA and
I send the MS 3 bits of the counter to the PSoC.
In the PSoC , I just forward the input signal to
the output port.
The input pins of teh PSoC are P2(5), P2(7) and
P4(6) which are connected with the FPGA I/Os.
The output pins of the PSoC are P0(1), P0(3)
and p0(5) , which are connected with the
connector J9.
I am noticing the counter signal at the input
of the PSoC, But not at the Output pins.
I have given the PSoC main.c code below.
If it is required I can give the VHDL code also.
Please help me, to find out the problem
with my code.
Thank You.
Project : PSoC_pin_status.app
==============================
main.c
=======
//----------------------------------------------------------------------------
// This project echos the state of port 2 pin 5 to port0 pin 5
// This project echos the state of port 2 pin 7 to port0 pin 3
// This project echos the state of port 4 pin 6 to port0 pin 1
//
// The status of output ports follow the status of their respective input ports.
//----------------------------------------------------------------------------
#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
void main()
{
while (1) {
if (PRT2DR & 0x20) {
PRT0DR |= 0x20;
}
if (PRT2DR & 0x80) {
PRT0DR |= 0x08;
}
Labels
- Labels:
-
PSoC 1
2 Replies
Anonymous
Not applicable
Aug 15, 2010
01:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 15, 2010
01:55 PM
I think that you are not checking the input port value properly. Try the following code instead:
if ((PRT2DR &= 0x20) > 0)
{
// put the bit toggling code here.
}
Aug 16, 2010
06:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 16, 2010
06:12 AM
Hi,
In PSoC Designer, first confirm that your inputs are set to "HIGH Z", not "HIGH_Z Analog".
Next, check that the output pins are set as outputs, eg, "Strong Slow".
Then to read the inputs use
while (1)
{
if (PRT2DR & 0x20) //if pin P2.5 is set
{
PRT0DR |= 0x20; // set pin P0.5
}
else
{
PRT0DR &= ~0x20; // clear pin P0.5
}
}
This should get you started. For more on GPIO see the following url:
http://www.planetpsoc.com/component/content/article/13-basics-of-psoc-gpio.html