Shop OBEX P1 Docs P2 Docs Learn Events
Question about multiple copies of MultiPWM 74HC595 object and stack space — Parallax Forums

Question about multiple copies of MultiPWM 74HC595 object and stack space

RobotWorkshopRobotWorkshop Posts: 2,307
edited 2012-02-01 20:59 in Propeller 1
I have a couple sets of 74HC595 chips (two sets of four) connected to the Propeller for LED lighting/effects on my project. I'd like to use the MultiPWM 74HC595 object here to control them:

http://obex.parallax.com/objects/437/

I was able to test out the hardware on the bench using one instance of the object and it seems to work well. Now I'd like to use two instances of it in my program. There are a couple of questions I have about this.

For the start method in the code I don't see where it is allocating any stack space. Is this something that I need to do for each one or should it be ok as it is and let the object handle it.

Is there going to be any issues with using the object twice in a project? I seem to recall reading that some objects may need to be edited and altered in order to use it more than once.

Comments

  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-01-13 09:11
    This is one of the posts I found regarding multiple versions of an object and what to watch out for.

    Is anyone using the MultiPWM 74HC595 object above and if so have you tried using more than one at a time?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-13 09:17
    I know I've used several instances of this object at a time.

    You only need to worry about stack space when a Spin interpreter is launched to a new cog. PASM drivers don't need additional stack space.

    If you can tolerate a slower PWM frequency the driver could be modified to control more than 4 chips.

    Edit: I was just looking at the object to see how to change it to use more than 4 chips. While the change could be done, it wouldn't be simple. There are too many advantages to using the 32 bits in a long to store the state of the 32 pins of the four chips. It's not a simple matter of changing a few constants.

    Edit again: I found the program where I use multiple instances of MultiPWM object. I used three instances in the program. As I mentioned earlier, stack space wasn't a issue.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-01-13 10:38
    Hello Duane,

    Thanks for your response! The propeller is connected to two separate remote daughter boards which each contain four 74HC595 chips. Running two instances of the object would work best so it looks like things will be ok. I should be able to do some testing this evening.

    Robert
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-02-01 20:00
    Using two of the MultiPWM objects for the 74HC595 chips works awesome. I am using it for the lighting on my robot and so far the effects are just what I was after. After I finish up some other parts of the project I'll go back and add some more effects to the LED lighting.

    http://www.youtube.com/watch?v=pDgvKn_u6Fk

    Robert
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-02-01 20:28
    That is so cool!

    Do you have details about this robot posted somewhere?

    What are you using for speech? Is it a text to speech board/chip or wav files.

    What about the speech recognition? What are you using.

    Do you have PC incorporated with the robot or some other brain?

    Again, this is so cool. Thanks for posting the video.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-02-01 20:59
    Hello Duane,

    Thanks for the kind comments! It has been a lot of work getting this far but I am really happy with the progress so far. I am writing up the whole project now and hope to have the rest of the robot finished and mobile by the time I finish writing the last part. I'm trying to get most of it functioning for a demo in a couple weeks for a cub scout pack meeting.

    One of the processors onboard is a Propeller that is handling all the lighting on the robot (there is a video of the back panel on my thread on the MAX7219), some other I/O, head control, and extra sensors. The main brain on this is running a laptop with software from the open source LEAF project. Speech recognition is the built-in Microsoft Speech. It ha s custom voice with some tweaking. I've had parts around for years and finally pulled it all together. There is a lot of customizations, custom parts, and all the wiring in the robot is from scratch. The code to share famous quotes I made yesterday and it has a couple hundred phrases in there now.

    The Propeller protoboard and one of the daughter boards for the LED's like this:

    H_595_C.jpg
    H_595_S.jpg
    PropHS.jpg


    I still need to add connector for a few limit switches and an encoder for the head to keep track of where it is. Once those are on I will finish the code for the head control.

    My website is long, long overdue for an overhaul and a lot of this will be posted there as well as other projects and past articles that I wrote for SERVO, Nuts'N'Volts, and MAKE.

    Robert
    800 x 605 - 154K
    800 x 603 - 169K
    800 x 631 - 134K
Sign In or Register to comment.