You are here

Cypress Maker Lab - Barc Go! Barc Stop! Barc Chase Your Tail! | サイプレス セミコンダクタ

Cypress Maker Lab - Barc Go! Barc Stop! Barc Chase Your Tail!

It's time for the finishing touches on Barc's motor control circuit. It's high time I took notice of the motor driver FLT (fault) signal and I want to add the ability to walk backwards.

I started by tidying up the wiring on the breadboard. Sree was giving me some mean looks about it. Here is the neater layout with the PSoC moved closer to the driver board and the wires running underneath where the two board plug in.

Barc robot dog - new wiring Barc robot dog - new wiring with kits

I thought the FLT signal would be easy. The documentation says that it is normally high and drives low if there is an over-voltage or over-heating problem in the driver chip. So I figured I could just AND the SLP (standby) and FLT. This should automatically turn off the motors if the FLT goes low. This would be another example of how flexible PSoC is and I drew up this circuit.

Barc robot dog - Using the FLT pin

I thought this looked really neat and made the fault protection really robust because it is in hardware, with no risk of an interrupt getting masked or anything naughty like that. There was just one problem. It doesn't work. The motors don't run. So I messed about with the circuit. I questioned my logic. I checked signals by wiring them to the LED. I questioned my sanity. And then I gave up and called my mate Sree. Sree is a real engineer and has a super-power I shall never possess. He can be bothered to read the documentation. I had burned most of my Sunday on this. Sree figured out over lunch that, when you enable the motors (via SLP) the FLT signal always drops low for 380 microseconds. Now, if I am honest, it actually took Sree about 3 minutes to find out the problem and the rest of lunch was taken up with me moaning about hardware and how much easier it would be to do this with software after all. But the end result didn’t change - my circuit cannot work.

I need to enable SLP, wait a while, and then start worrying about FLT. I was mulling over a plan of using a second counter to start timing when the button is pressed and sample FLT after 380us. But it seemed like overkill for the actual problem and I did not like that it meant we would be running the motor without checking FLT, even if it was for a really short period of time. Ideally I wanted to turn on SLP but keep the AIN and BIN signals low (so no load was put on the motors) until FLT was ready to be read and was high. Enter the PWM kill signal. The PWM I am using to drive the motors has an optional kill input which sets the outputs low when the kill is high. This is a really easy way to protect the motors. Press the switch and enable the motors with the PWMs killed. As soon as the FLT goes high the PWMs start. This is a really elegant solution that does not require an extra counter or make any assumptions about how long the delay on the fault signal is. I programmed it into Barc and tested that FLT does, indeed, stop the motors by wiring it up to ground before and after pressing the switch.

Barc robot dog - FLT pin KILL on PWM

I feel a lot safer now. With Embedded World just a few days away I am less likely to blow up my demo! Let's add some maneuverability to this hound. I can go forward, left and right, but I cannot reverse or spin on the spot. Real dogs are pretty good at that. I need to be able to switch the PWM outputs to the AIN and BIN pins. I am going to do that by using a control register. This is an 8-bit register (I only need 2 bits) that lets me set hardware signal from firmware. Each bit shall define the direction of the motor and, in the schematic, I will simply use some more AND gates to send the signal to the desired pin. Pictures are worth a thousand words, so here is my circuit, starting with the control register, which I have called Direction.

Barc robot dog - control register

Note how I have named the wires to make the drawing easier - it helps to see what is going on that way too. The PWM outputs get ANDed with the direction signals to either hold the pin low or pass through the PWM signal. Note that I re-enabled the HW connection on the AIN2 and BIN1 pins so I can connect them to the gates (and I no longer set them from firmware).

Barc robot dog - control register for direction and PWM for speed

A little splash of firmware and we have a dog that can walk forwards and backwards and chase his tail in both directions.

#include "project.h"

int main(void)


   uint8 dir = 0;




       Direction_Write( dir++ );

       CyDelay( 1000 );   




I am happy with Barc's agility now. He is nearly ready for the big dog show in Germany! Just one last problem to solve . How to make him "see" people and interact with them. This sounds like a big task, but PSoC's CapSense makes this quite simple… next time.




laorilearner_2527786's picture

What are the directions, if the control stability item is changed? CapSense isn't always working well for such tools as Editorpaper, cheap essay or ReadMeon.

csjoshi.editsoftdigital_2593831's picture

More About the Concept of an Afterlife: The only part of you that could in any way survive into an afterlife would have to be an immaterial part of you since when you snuff it, your material remains go nowhere. But any immaterial part of you would have no sensory apparatus so how could you enjoy an afterlife when you couldn't experience it? On the other hand, if your life is but a computer simulation, then equally so could your afterlife be another simulation. One software program ends (death) and another begins (afterlife).

nishgau28_2730811's picture

I love to play games on playstation as it is very interesting and exciting. Playstation codes are available on the mentioned website for free. Grab ps plus codes for psn games and explore all the features on online line psn games.


lucychrisan_2813081's picture

PSN is one of the biggest gaming platforms. PSN Network’s services are dedicated to an online marketplace, a premium and paid subscription service for enhanced gaming and social features with wonderful graphics, and get them all here for free, what more you would expect PSN Card Codes Free. Its all available on the single website. Our offers are very easy to complete and within a minute you will be able to earn desired PSN Codes to fulfill your wish to compete in all PlayStation online games. It's amazing to play PSN games online and I would love it to share it with everyone. What if you get PSN codes for free. Yes its real, now its available for free on this very website, Visit to grab these codes. These free PlayStation plus codes and hack for PSN games all are available for free. Have a try 



sheikhnuman78_2850116's picture

Finally, NBA live Mobile game has arrived and gamers must not waste a moment to hit the court with the most amazing basketball game ever produced till date. NBA live Mobile is a special gift for all basketball lovers who follow NBA events and think of owning a strong team that will dominate the opponents. This game is from the same team of madden mobile inventors. This particular mobile game offers you a wonderful opportunity to stay connected with NBA live events all year along with an amazing 5-on-5 action. With your efforts and skills, it is very much possible to capture the spotlight and construct a team to beat in the competitive world of basketball. There is a lot to know about the game but we would mainly like to focus on best possible ways to attain coins and cash. If you have been part of the game for a while, you would be completely aware of the need to get many coins and cash in order to build a strong team and add legend players. Surely, there are certain ways to do the job but the most effective one is to use NBA Live Mobile Hack And Cheats.


sheikhnuman78_2850116's picture

Enjoy easy access Instagram followers hack no survey no download whenever. Wait let alone download now! Share this app, because the more you use it, the more followers and like you’ll get Instagram Followers For Free.

matthewjensen119_3221321's picture

I think it's clean and makes the bug defense very powerful because it's a hardware application that does not interfere with or damages your entertainment. This is a very good solution that believes that an interview, buy essay online or additional preconditions do not require a delay period. 

Cathy anna's picture

I read your blog and really glad to know about the finishing touch on the Barc’s motor control Unit. Nice to see it’s picture here and the diagram shared here clearly specifies its connection. Anyone can understand its working through this details shared here. paris sightseeing tours

このサイトに掲示されているすべてのコンテンツと資料は、「そのままの状態」で提供されます。サイプレス セミコンダクタとその関連サプライヤは、これらの資料について、いかなる目的への適合性をも表明することはありません。また、これらの資料について、すべての保証や条件を放棄します。これには、暗示的な保証および条件、商用性、特定の目的への適合性、すべてのサードパーティの知的財産権に対する権利と非侵害などが含まれますが、これらに制限されることはありません。サイプレス セミコンダクタにより、明示または暗示にかかわらず、禁反言などによるライセンスは、付与されないものとします。このサイトに掲示されている情報の使用には、サードパーティまたはサイプレス セミコンダクタからのライセンスが必要となる場合があります。

このサイトのコンテンツには、特定のガイドラインや使用制限が含まれている場合があります。このサイトにおけるすべての掲示やコンテンツの使用は、サイトの利用規約に準じて行われるものとします。このコンテンツを使用するサードパーティは、制限やガイドラインに従い、このサイトの利用規約を遵守するものとします。サイプレス セミコンダクタとそのサプライヤは、コンテンツや資料、その製品、プログラム、サービスに対し、いつでも修正、削除、変更、改善、向上、その他の変更を加える権利を有します。また、いかなるコンテンツ、製品、プログラム、サービスを予告なく変更または閉鎖する権利を有します。