- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to generate an 8-bit TTL word using PSOC. For this I have to be able to turn on up to 8 pins simultaneously. How could I do this?
Solved! Go to Solution.
- Labels:
-
PSOC5 LP MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PaFi,
Since you have listed "PsoC5 LP MCU" as a tag, I'm going to assume this is the processor you are using.
The answer to your question is EXTREMELY easy!
In the TopDesign place an "Digital Output Pin" component on the schematic page.
Now on it, Right-click select "Configure ..."
Select he "Number of pins:" field and change it to '8'.
Next select the "Mapping" Tab. Make sure "Contiguous" is checked. (If you want to make the symbol smaller, you can also select "Display as a Bus".)
The next step is to assign which pins are used for this 8-bit port. Go to the "Design Wide Resources/Pins" tab (with the extension of .cydwr) and select the port to use as shown below.
The last step is to include the code to change the port value bits at the same time.
In the appropriate points in your code you can access the output port as shown (Note: The 8-bit port name in my example is named "Pin_1". You can name it differently as needed):
Pin_1_Write(new_8_bit_value);
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PaFi,
Since you have listed "PsoC5 LP MCU" as a tag, I'm going to assume this is the processor you are using.
The answer to your question is EXTREMELY easy!
In the TopDesign place an "Digital Output Pin" component on the schematic page.
Now on it, Right-click select "Configure ..."
Select he "Number of pins:" field and change it to '8'.
Next select the "Mapping" Tab. Make sure "Contiguous" is checked. (If you want to make the symbol smaller, you can also select "Display as a Bus".)
The next step is to assign which pins are used for this 8-bit port. Go to the "Design Wide Resources/Pins" tab (with the extension of .cydwr) and select the port to use as shown below.
The last step is to include the code to change the port value bits at the same time.
In the appropriate points in your code you can access the output port as shown (Note: The 8-bit port name in my example is named "Pin_1". You can name it differently as needed):
Pin_1_Write(new_8_bit_value);
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you a lot for such a detailed guide Len. Before I accept this as a solution, could you explain to me why this is dependent on the processor in my board?
Also why is indexes of the Ports go from 7 to 0 and not reversed, does it mean that my first bit would correlate to the 7th port of chosen group?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PaFi,
My steps should apply to the PSoC5 and PSoC3. This forum also includes the PSoC1. PSoC1 has different resources and access.
If you chose Port 1 (P1[7:0]) the bits of this port would be used. Bit 7 = Bit 7 of the 8-bit Byte. Bit 0 = Bit 0. Therefore you have to route your circuit to all the pins of that port.
Does this answer your question?
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, thanks a lot again! It was just a bit weird to me why they write P1[7:0] and not P1[0:7].