November 22, 2024, 03:07:16 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Prop 1 code to DC-16

Started by Jadams, September 03, 2010, 06:44:36 PM

Previous topic - Next topic

Jadams

I'm using the following routine, from one of your examples, on my MIB with a Prop 1.  I want to move it to the DC-16 but don't know the correct syntax.  Any examples will be appreciated. 

Thrash:
  RANDOM lottery                                ' re-stir
  delay = MaxJump - MinJump + 1                 ' get span
  delay = lottery // delay + MinJump            ' calc jump timing
  Lid   = IsOn - Lid                            ' toggle cylinder
  Base = IsOn - Base

  flash = lottery & %00011010                   ' isolate lights
  PINS = PINS &/ %00011010 | flash              ' update light outputs

PAUSE delay                                   ' hold
  timer = timer + delay                         ' update run timer
  IF timer < 10000 THEN Thrash               ' if not done, go again


I haven't assigned any outputs yet in the DC-16 so any setup will work.

Thanks
Jim Adams

JonnyMac

More information is always better than less; for example, are you expecting to do other things with the DC-16 outputs while the MIB output is doing its thing?
Jon McPhalen
EFX-TEK Hollywood Office

Jadams

No, just those 4 outputs go to the DC-16.  I need to make a correction:

The lights are only on PIN3 and PIN4

flash = lottery & %00011000                   ' isolate lights
PINS = PINS &/ %00011000 | flash              ' update light outputs


I need to free up some outputs to add a couple of servos and 'eyes' to the MIB.  I'm just looking for an example so I can experiment and learn how to make it work.

Thanks

Jim Adams

JonnyMac

At the risk of repeating myself (not with you)... <wink>  servos need to be updated every 20 milliseconds for them to behave properly. 

As soon as you start mixing in servos and a serial device (which consumes time to "talk" with) and MIB-style random timing things get ENORMOUSLY complicated and it will take a lot of programming trickery to mix them all together.  This is really better suited for a Prop-2 -- we offer different products for different levels of applications.

That said, I'll try to help. Just give me your desired local (on Prop-1) and remote (on DC-16) pin list and what they do.  I'm in and out today so it may not be until tomorrow morning that I have code for you.
Jon McPhalen
EFX-TEK Hollywood Office

Jadams

Sorry for the delay in getting back to you.  I have was able to free up 2 outputs on the Prop 1 and will not need the DC-16.

Thanks for all your support in this forum.
Jim Adams

JonnyMac

Whew!  Trust me, I was not looking forward to writing that program!  ;D  Do keep in mind, though, that you have to maintain the servos, so you'll want to create a delay routine used by the MIB movement section that updates them, too.
Jon McPhalen
EFX-TEK Hollywood Office

Jadams

Thanks Jon, I did get everything in the MIB working the way I wanted using a Prop1, 2 solenoids, Ap-8, and 2 servos.  This latest problem may need to be moved to the audio section.

When the servos are activated, I can hear the motors running through the speakers.  Not too loud, but noticeable.  Any way to filter out the noise?  I did a search on the site and didn't find anything similar.
Jim Adams

JonnyMac

Servos are generally being updated at 50 Hz and I suppose it is possible for this signal to get superimposed on the audio outputs if the wires are running side-by-side; separation is the only thing you can do.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

If your not already, try using a separate power supply for the AP-8 and/or any amplifier you are using. If that doesn't help, try a separate power supply for the servos.

Jadams

Hey, great call.  The seperate power supply on the amp did the trick.  I was using a common 1.5 amp PS for all the devices. 
No servo noise to the speakers. 

Thanks JackMan, I'm glad you guys have lots of rabbits in those hats.
Jim Adams