Jump to content

MIOS_DOUT_SRSet


DriftZ
 Share

Recommended Posts

Hi, I'm a little bit in doubt about following function:

FUNCTION MIOS_DOUT_SRSet

DESCRIPTION sets value of DOUT shift register

IN number of shift register in WREG

value in MIOS_PARAMETER1

OUT pointer to shift register in FSR1

USES FSR1 and BSR

Is this function to set the active SR (followed by an instruction to set one pin H or L; bit operation) or can it be used to send a byte (value MIOS_PARAMETER1) to a specific SR (number in WREG)?

My experiments give me confusing results, but I managed to get (mostly intended) stuff on my display.

thanks & greetz

Link to comment
Share on other sites

There is no active SR, MIOS loads the whole SR chain (16 DIN shift registers and 16 DOUT shift register) on every update cycle. You can use the MIOS_DOUT_SRSet function whenever you want (within or outside an interrrupt service routine) to set the 8-bit value of a single shift register directly. You can also use this function to get a pointer to this register to access it several times without loosing instruction cycles due to the "call" overhead.

The functions for setting a single pin are called MIOS_DOUT_PinSet0 and MIOS_DOUT_PinSet1

why different functions? Because MIOS_DOUT_SRSet works much faster (since you are able to set 8 pins at once and you are able to work with the return pointer), but MIOS_DOUT_PinSet[01] looks more understandable for beginners who are reading the source code.

Best Regards, Thorsten.

Link to comment
Share on other sites

Hi,thanks for answering this quick, so it works like I was hoping for.

So the following 2 snippets should give the same result?

=====================================

movlw b'01010101'

movwf      MIOS_PARAMETER1

movlw 1

call      MIOS_DOUT_SRSet

=====================================

     movlw 0

     call      MIOS_DOUT_PinSet0

     movlw 1

     call      MIOS_DOUT_PinSet1

     movlw 2

     call      MIOS_DOUT_PinSet0

     movlw 3

     call      MIOS_DOUT_PinSet1

     movlw 4

     call      MIOS_DOUT_PinSet0

     movlw 5

     call      MIOS_DOUT_PinSet1

     movlw 6

     call      MIOS_DOUT_PinSet0

     movlw 7

     call      MIOS_DOUT_PinSet1

=====================================

In my eyes it should, but it doesn't  :-/

Link to comment
Share on other sites

Ahaaa ! progress  ;D

but still it is not 100% correct,

I think it shud be read right to left:

movlw b'10101010'

movwf MIOS_PARAMETER1

movlw 0

call  MIOS_DOUT_SRSet

presented with PIN numbers:

movlw b'76543210'

It seems to work now, cool thanks  :D

time to break my brain on the next steps  :P

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...