Shop Learn P1 Docs P2 Docs
Moving a long from one ASM object as Output to Another as Input — Parallax Forums

Moving a long from one ASM object as Output to Another as Input

I rebuilt on of my 24/32 Channel DMX dimmer boxes and have a P1 quickstart board running it. I used to have a 24 channel dimmer code that drove ouput pins directly to the triac dimmers, but this will not drive 32 channel. I added 4 74Hc595 Serial/Latchs to get to 32 output. The demo method for the 74595 driver says to just get the bit pattern into Shiftdata variable.

This is the end of dimmer ouput code. I changed the OUTA register to the outdata variable

       the last  lines in my dimmer routine :
           add  ch11level, #1    wc

'if_c or outa, Hex1000 pin 12 - commented out
if_c or outData, Hex800 'output bit 12

           mov       listout, outData            '  does not work!!!!
          waitcnt   timer, #dimloop           'waits out rest of ac cycle
          jmp      #waitzcl                            'next cycle

listout res 1
outData res 1

In the Simple_74hc595 objects.
long ShiftData 'is present

I can send individual bit control to the serial latches, but I can't figure out how to get the "outData" value that the dimmer ASM routine builds.

Rick Asche rasche297@gmail.com
aka AgedBeaver

Comments

  • JonnyMacJonnyMac Posts: 8,222
    edited 2022-09-21 02:23

    You need a shared location in the hub. If Object A builds the long, it will then write to the shared location. Object B will read that location for the updated value.

  • If my shared location is a declared Global "listdata" and the data to be shared is outData.

    Is the statement in the object A " WRLONG listdata, @outdata

    And to get this into object B "RDLONG ShiftData,@listdata

    I know it should be this simple, but cant seem to get the "outdata" value out of my dimmer24 ASM routine.

  • JonnyMacJonnyMac Posts: 8,222
    edited 2022-09-22 18:34

    I know it should be this simple, but cant seem to get the "outdata" value out of my dimmer24 ASM routine.

    It doesn't help anyone help you that you're not sharing your code (hint, hint).

    I knocked together a quick demo that has two PASM cogs, both of which get the hub address of a counter. Cog A modifies the counter and Cog B will display the lower two bits of the count on the PAB/FLiP LEDs. The parent (which starts the other cogs) monitors the count for change and displays the value on a terminal.

    Hopefully, this helps you understand sharing a hub value with two PASM cogs.

Sign In or Register to comment.