Shop OBEX P1 Docs P2 Docs Learn Events
outa, outb etc. safe to use as registers? — Parallax Forums

outa, outb etc. safe to use as registers?

pullmollpullmoll Posts: 817
edited 2013-09-11 08:31 in Propeller 1
Is it safe to use outa[noparse][[/noparse]31..0], outb[noparse][[/noparse]31..0], ctra[noparse][[/noparse]8..0], ctrb[noparse][[/noparse]8..0], frqa[noparse][[/noparse]31..0], frqb[noparse][[/noparse]31..0], phsa[noparse][[/noparse]31..0], phsb[noparse][[/noparse]31..0], vscl[noparse][[/noparse]31..0] as storage for registers when a cog does not use I/O (i.e. dira/dirb remain 0) and no timers or video? I tried it and it seems to work, while I don't know if this may have unwanted side effects.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects

Comments

  • sylvie369sylvie369 Posts: 1,622
    edited 2010-04-09 15:23
    Interesting idea. Since port B refers to pins that do not exist, it's hard to imagine that there'd be unwanted side effects from using those 16 locations, though I guess forward compatibility might be a potential problem.

    I'll be interested to see what the knowledgable folks say about this.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-04-09 15:26
    If ctrx is set to something that enables it, and if frqx is non-zero, phsx can change on its own.

    -Phil
  • MagIO2MagIO2 Posts: 2,243
    edited 2010-04-09 15:32
    ctra and cntrb? Don't these registers switch on counters? So, in case you load random values you would accidently switch on the counters. It won't effect the pins as long as dira is switched off, but your frqa, frqb will be destroyed ... or is it phsa and phsb ... did not do to much with counters up to now ;o)

    You can even use INA as a shadow register for some special purposes. You can use it as destination register. For example:

    mov ina, ina
    and ina, #$ff
    wrbyte ina, pos_in_hub



    PS: I should move to a timezone where everybody is sleeping when I answer posts here ;o))
  • pullmollpullmoll Posts: 817
    edited 2010-04-09 15:44
    Phil Pilgrim (PhiPi) said...
    If ctrx is set to something that enables it, and if frqx is non-zero, phsx can change on its own.

    -Phil

    That's why I wrote ctra[noparse][[/noparse]8..0] and ctrb[noparse][[/noparse]8..0]. I'm using these two to keep values that don't reach into the counter mode bits 30..26, but just the APIN and the unused bits 8..6.
    What I wanted to know was if doing this, and writing the FRQx and PHSx registers does anything if the counters are off?
    I'm really out of cog space this time as you probably guessed smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pullmoll's Propeller Projects

    Post Edited (pullmoll) : 4/9/2010 3:49:43 PM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-04-09 16:48
    You should be safe, in that case.

    -Phil
  • BeanBean Posts: 8,129
    edited 2013-09-11 08:09
    So does
    wrbyte ina,hubPos
    

    Actually write the state of pin 0-7 into hub memory ?
    Or will ina in the dest position use the ina shadow register and not the actual state of the pins ?

    Bean
  • Mike GreenMike Green Posts: 23,101
    edited 2013-09-11 08:31
    INA is a source register only. Any use as a destination references the shadow register. Even though WRBYTE reads from the destination, it's still a destination reference and, with INA, will reference the shadow register. hubPos is a source field and is used for the source of the hub address, not the hub location itself ... that's the job of the hub hardware, not the cog.
Sign In or Register to comment.