Encoder connection to simplified c block
Hello
When connecting the encoder directly to the C block, the software gives an error. What is the reason for this problem and what solution do you suggest?
I have identified the problem in the picture.
Answers
-
What error message did you see?
Your attached picture does not show how the encoder is connected to the C block.
This picture shows that all the input ports of your C block are floating, not connected to any signal.
Doesn't your C code need any input signal? If not, why do you have 3 input ports for the block?
Please attach you PSIM schematic to this question. The details in the components' parameter settings provide useful information for finding your problem.
0 -
Hello
Thank you for your reply
The encoder is connected to block C. I removed this connection to make sure that the mentioned error will be fixed or not
Now I will show you the picture of the circuit with the complete connection and the corresponding error
Of course, I think that there should be an element between the encoder and block C, but I don't know what it is?0 -
Hi, Reza,
In the 2nd picture, you have connected the 3 input signals of the C block "SSCB1" to the 3 signals outside the F28335 MCU. Those 3 signals are from a mechanical encoder.
The output signal of this C block "SSCB1" is connected to "SSCB2" which is obviously is inside of the F28335 MCU.
The question is: Is this block SSCB1 outside or inside of the F28335 code?
If this block is outside of F28335, you should connect its output to a F28335 port.
If this block is inside of F28335, you should use F28335 ports to bring the 3 input signals inside F28335. You may use the F28335 blocks such as ADC, Digital Input, Encoder, Capture, and etc.
Any signal outside of a MCU must be brought inside via some kind of port. The code inside of a MCU CANNOT read the outside signals without assigned connections.
Even if your MCU supports wireless connections, you must assign the signals to the wireless ports.
0 -
as rhonda mentions this connection is not possible.
if you remove the PWM block this will run. For every signal that will be compiled with the code gen it needs to go through a target peripheral like GPIO, ADC, SPI etc. then out through the PWM or GPIO. You need to be careful with this sort of signal if you put it through a GPIO you will likely require a high interrupt rate to properly resolve the encoder, this is why there is a purpose built encoder block, which is to the right of you c code. The peripherals of these targets are setup to deal with the issues of interrupt rates and edge detection.
0