November 21, 2024, 07:32:53 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.


Condensing Codes on Prop-1

Started by Natalie P, June 07, 2014, 09:56:10 PM

Previous topic - Next topic

Natalie P

I apologize in advance as this is a likely a remedial question: I have used this code:
SEROUT Sio, Baud,("!DC16", %00, "S", %00000100, %00000000)
...to turn several outs on and off at once on the DC-16 board instead of having to reference each individual out.  Using this same condensed format, how do i write it out when I want to use this directly for the Prop-1?

JackMan

Pretty simple. Here's some examples.
PINS = %00000000 (all off)
PINS = %11111111 (all on)
PINS = %10000001 (OUT0 and OUT7 on)

JonnyMac

As Jack points out, PINS it is. That said, make sure you set the DIRS register to setup your pins as outputs first. For example, I pre-configure most of my programs to have P7 as serial control of external devices (setup as input -- SEROUT/SERIN will reconfigure), P6 as my trigger input, and P5..P0 as my outputs. The reset section in my standard template looks like this:

Reset:
  PINS = %00000000
  DIRS = %00111111


The first line clears any outputs (I can jump back to this at the end of a cycle), the second line sets P5..P0 as outputs so that I can write directly to PINS later.
Jon McPhalen
EFX-TEK Hollywood Office

Natalie P

Cool, thanks!  So then this code option is only applicable for the PINS.  Is there code for using the OUTS in this format?

JackMan

June 16, 2014, 04:21:46 PM #4 Last Edit: June 16, 2014, 04:24:02 PM by JackMan
 The TTL pins and the OUT's are both active at the same time. You can't turn on just a PIN or just an OUT.
In other words, if PIN0 is active, OUT0 will be active as well.

Natalie P

Ahh okay...thank you for clarifying, JackMan!  :D

JonnyMac

And now for the scary (yet important) details....

The W pins on the TTL headers are what we call "active high," that is, when you make the pin HIGH it will be at 5v. When you make the pin LOW it will be a 0v -- both referenced from the B (ground) pins.

The OUTx connectors are called "open collector." What this means is that these outputs act like an open switch until you make the associated pin go HIGH. When you do, the "switch" closes and connects to the ground side of the circuit. This is why connections on the OUTx terminal are always between the V+ terminal (positive voltage) and OUTx (switched ground).
Jon McPhalen
EFX-TEK Hollywood Office

Natalie P

Excellent, thank you!, JonnyMac!  I understood how the OUTs function but appreaciate the explaination of it all!  :D