November 22, 2024, 12:16:06 AM

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.


PINS with Prop2?

Started by steveo, March 13, 2008, 09:31:16 PM

Previous topic - Next topic

steveo

Jon,
Sorry to pester you. In a Prop1 related thread ("Weirdness with PWM") PINS was used to set up states for led outputs. How is this accomplished with BS2?

How are following lines expressed in 2.5? After having fun with the branch command tonight I tried to figure this out, but no luck.

SYMBOL    LED    = PINS

SYMBOL  AllOn    = %11111111

Leds = AllOn




steveo

Once again, my streak of answering my own question 10 minutes after posting for help is alive and well!

Jon,
Please strike this from the forum, unless you need me to school you on some programming.

(I keed! I keed!)

JonnyMac

The BS1 PINS register is interesting: You can write to it or read from it.  In the BS2 you write to the OUTS register (16 bits) and read from the INS register (also 16 bits).
Jon McPhalen
EFX-TEK Hollywood Office

steveo

Can I PWM using OUTS? So rather than fade on pin, i can fade multiple?

JonnyMac

Not simultaneously, no -- you need a Prop-SX and a "background" PWM driver to do that.  Depending on your application you could use a single PWM control output that drives a transistor, then use that transistor to modulate multiple outputs.
Jon McPhalen
EFX-TEK Hollywood Office

steveo

While on the subject of PINS in BS2, what do the different "OUT" commands mean?

(OUTA, OUTH, etc.)

JonnyMac

In the Prop-2, one writes to the OUTS (pins in output mode) register.  OUTS is 16 bits (a word).  Within PBASIC, it can be subdivided into groups:

  OUTL = P0 - P7
  OUTH = P8 - P15

Since the BS2 supports nibble (4-bit) variables, and I/O pins (and pin groups) are in fact variables, we can also do this:

  OUTA = P0 - P3
  OUTB = P4 - P7
  OUTC = P8 - P11
  OUTD = P12 - P15

Note that for inputs we use INS (pins in input mode), and the logic follows as above.

You can see the reason for us putting four SETUP pins on the Prop-2; this pins correspond to the D group and could be read IND (when used as switch/button/sensor inputs).
Jon McPhalen
EFX-TEK Hollywood Office