Shop OBEX P1 Docs P2 Docs Learn Events
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,926
    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,926
    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.

  • I have made progress on debugging this with Jon's help but feel like my approach is a little clumsy. I have include the code in the zip file and extracted screenshots of the area causing the difficulty.
    The first image shows the VAR area where my globals are declared and the location of the VAR data coming back from the dimmer method.


    the included methods I'm using.

    Presently how I'm getting data to the shift out method and the physical output.


    This last block is the Asm output area where I WRLONG to the "DimmerShiftData" variable and use the
    Out() method in the Simple74HC595 Object.

    I have the "ShiftData" pointer in the Main routine. I tried to pass this address to my dimmer method and then WRLong to the ShiftData address, but does not work for me.

    For testing purposes, i'm sending "56" from the output and this pattern does show up in the shiftdata pattern, so it works, but is there a better way.

Sign In or Register to comment.