Bus出力ラインから任意のbitを取り扱う方法(PSoC5LP)

Tip / ログイン to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

コンポーネントがBusのタイプしか出せない、BasicCounterなどで、その内の1bit、例えばbit2のみを使いたく添付ファイルの様にしてみたのですが、[2]のソースが無いとエラーになります。

Bus出力ラインから、任意のbitをつかうにはどうすれば良いでしょか?

 

※PSoC5LP CY8C5868AXI-LP035 Creator4.3 CY8CKIT-001 での質問となります。

0 件の賞賛
1 解決策
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

YuMA,

The BasicCounter is intended on being used as a base counter for more sophisticated functions such as implemented using UDBs.

The BasicCounter provides as many bits in a "bus" as defined in your configuration. Each bit is the actual count of the counter as it progresses in time.

You can read any bit or bits if you place a Status Register on each bit you want to observe. 

You can also use one of the bits to trigger interrupts.

Using a Digital Comparator, you can trigger a signal (such as an ISR) based on the counter count value.

Here's a schematic snip showing these methods.

Len_CONSULTRON_0-1674239767610.png

 

Len
"Engineering is an Art. The Art of Compromise."

元の投稿で解決策を見る

15 返答(返信)
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

YuMA,

The BasicCounter is intended on being used as a base counter for more sophisticated functions such as implemented using UDBs.

The BasicCounter provides as many bits in a "bus" as defined in your configuration. Each bit is the actual count of the counter as it progresses in time.

You can read any bit or bits if you place a Status Register on each bit you want to observe. 

You can also use one of the bits to trigger interrupts.

Using a Digital Comparator, you can trigger a signal (such as an ISR) based on the counter count value.

Here's a schematic snip showing these methods.

Len_CONSULTRON_0-1674239767610.png

 

Len
"Engineering is an Art. The Art of Compromise."
YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

バス配線のエラーですが、一度PSoc Creatorを終了して、再度立ち上げたところビルドエラーはなくなったとの事です。

 

またバス配線について追加で質問を受けましたので、下記内容について回答頂けないでしょうか?

 

①今回[2]とした信号線(bus.pngのファイル参照)が、ほかのBUSの同じ名前の[2]とは区別されるのでしょうか。


②今回は[2]としましたが、ユニークなバス名を使えるでしょか、

 例えばBUZC[2]

※Signal Nameで"BUZC"と入力したところ、ビルドエラーとなりました。

 

YuMa_1534086_0-1674525960621.png

 

 

どうか宜しくお願いします。

0 件の賞賛

YuMa,

Is this what you were asking?

Len_CONSULTRON_0-1674533919496.png

This compiles with NO Application Build errors.

Len
"Engineering is an Art. The Art of Compromise."
0 件の賞賛
lock attach
Attachments are accessible only for community members.
YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

返信有難う御座います。

 

私の方で試したプロジェクトファイルを添付します。

2つのプロジェクトがあります。

 

BasicCounterから直接ビット線(BUZC[2])だけを配線したプロジェクト(PSoC5LP_BUS.cydsn)だとビルドエラーとなります。

BasicCounterからバス線(BUZ[2:0])を配置して、そこからビット線(BUZC[2])を配線するとビルドは成功します。(PSoC5LP_BUS_Copy_01.cydsnのプロジェクト)

 

頂いた構成もバス線からビット線が配線されているかと思います。(下図のような構成、赤丸がバス線)

YuMa_1534086_0-1674538247579.png

 

バス・ワイヤを配線する場合のルール、みたいなものがあるのでしょうか?

配線に名前を付ける場合は、バス・ワイヤを配置した後にビット・ワイヤを配線する必要があるのでしょうか?(名前を付けたビット・ワイヤをコンポートに直接接続することはできない?)

 

また下記質問もご確認頂ければ助かります。

>>①今回[2]とした信号線(bus.pngのファイル参照)が、ほかのBUSの同じ名前の[2]とは区別されるのでしょうか。

 

 

どうか宜しくお願いします。

0 件の賞賛

YuMa,

PSoC5LP_BUS_Copy_01 does build but PSoC5LP_BUS does not as you stated.

PSoC5LP_BUS throw an error: ADD: sdb.M0024: error: Terminal "BasicCounter_1.cnt[2:0]" with width 3 is connected to "BUZC[2]" with width 1.

This is because you routed a single wire (width 1) directly into a pin that happened to be configured as a bus of width 3.

Len_CONSULTRON_1-1674567918022.png

 

In project PSoC5LP_BUS_Copy_01 you correctly connected a signal with width of 1 onto a bus with a width of 3.  

Len_CONSULTRON_2-1674568101925.png

Wiring Rule: Separating signals on a bus of width > 1 must occur from a bus.  A pin configured as a bus must exit the pin as a bus of the same width as the pin.

I hope this answers your question.

 

Len
"Engineering is an Art. The Art of Compromise."
0 件の賞賛
YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

回答有難う御座います。

 

ただビルドエラーになったプロジェクトでもバス・ワイヤの名前をつけないようにすると("Specify Full Name"のチェックボックスを外すと)、ビルドが成功するになります。

(下図のようにワイヤ線の名前を付けないと、ビルドはPassするようになります。)

 

ワイヤ線の名前を付ける、付けないで、ビルドの結果が変わってしまう理由が分かりません。

何か理由など分かりますでしょうか?

 

YuMa_1534086_2-1674606799163.png

 

 

どうか宜しくお願いします。

 

0 件の賞賛

YuMA,

You are correct.  I'm afraid I don't have a good explanation.

Len
"Engineering is an Art. The Art of Compromise."
0 件の賞賛
YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

ご回答有難う御座います。

承知致しました。

 

また下記質問ですが、配線名が同じでもバスが異なれば区別される、という理解で良いでしょうか?

>>①今回[2]とした信号線(bus.pngのファイル参照)が、ほかのBUSの同じ名前の[2]とは区別されるのでしょうか。

 

お手数ですが、どうか宜しくお願いします。

0 件の賞賛

YuMa,

Any signal not specifically named with by given a system generated name like "Net_nnnn" where nnnn is a number assigned.  Therefore if you place a wire (signal) and do not specify a specific name (See spic below)

Len_CONSULTRON_0-1674644582645.png

It will assign a Net_nnnn to it.  The result in this specific case is: Net_20[2] as shown here when I hover over the wire.

Len_CONSULTRON_1-1674644692580.png

If you can connect this wire to another wire with the same net name, then it will share the same signal when the circuit compiles.

Len
"Engineering is an Art. The Art of Compromise."
0 件の賞賛
YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

回答有難う御座います。

 

念のための確認にはなってしまいますが、下記内容について回答頂けないでしょうか?

 

下図のような構成にした場合、それぞれ[2]とした信号線(赤丸部分と青丸部分)は同じではなく区別される、という理解で良いでしょうか?

 

YuMa_1534086_0-1674692743591.png

 

 

Specify Full Nameにチェックを付けて、ワイヤに名前を付けても(BUZC、とか)、特に問題はない、という理解で良いでしょうか?

 

お手数ですが、どうか宜しくお願いします。

 

 

0 件の賞賛

YuMa,

In question 1, I don't see the difference between the signal in the RED circle and the BLUE circle.

However, the signal with assign bit 2 ([2]) in the RED circle is NOT the same signal assigned bit 2 ([2]) in the BLUE circle.  They will NOT be connected in the PSoC.

The way to determine this is to select each wire in the schematic and hover over it.  It will display the assigned Net name.  They will be different.

In question 2, if you assign a name to the signal (such as BUZC), it will use that as the Net name.  Therefore a BUZC[2] on one circuit and a BUZC[2] on another circuit is the same connected signal.

I hope I answered your questions.

Len
"Engineering is an Art. The Art of Compromise."
0 件の賞賛
lock attach
Attachments are accessible only for community members.

YuMa,

There are a couple of other solutions to bus routing, which I use frequently, using custom components: the Dummy and BusConnect. The components are virtual - they are completely eliminated by the fitter during bus routing, but they allow to "kill" the names of the buses or lines, or changing their names (see component Datasheets for examples). Project is attached.

Figure 1. Using the Dummy to clean the wire name and index

PSoC5LP_BUS_Dummy_A.png

Figure 2. Using the BusConnect to extract particular bit(s) from the bus. The output is unnamed line.

PSoC5LP_BUS_BusConnect_A.png 

YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

Len-san, odissey1-san

 

Thank you for your support.

I understand.

This question was solved.

 

Best Regards.

YuMa

0 件の賞賛

YuMa-san,

We're welcome.

If one of the posts solved the issue, please select the "Accept as Solution" button on it. If none of the posts on this thread solved the issue, please post the solution and select "Accept as Solution".

It may be helpful to others with a same/similar issue.

Len
"Engineering is an Art. The Art of Compromise."
0 件の賞賛
YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

Len-san.

 

Sorry I forgot to press the button.

I selected "Accept as Solution" button.

 

Best Regards.

YuMa