DriftZ Posted September 18, 2003 Report Share Posted September 18, 2003 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 WREGvalue 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 Quote Link to comment Share on other sites More sharing options...
TK. Posted September 18, 2003 Report Share Posted September 18, 2003 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_PinSet1why 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. Quote Link to comment Share on other sites More sharing options...
DriftZ Posted September 18, 2003 Author Report Share Posted September 18, 2003 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_PARAMETER1movlw 1call 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 :-/ Quote Link to comment Share on other sites More sharing options...
TK. Posted September 18, 2003 Report Share Posted September 18, 2003 It doesn't, because the first shift register begins with index 0, not with 1Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
DriftZ Posted September 19, 2003 Author Report Share Posted September 19, 2003 Ahaaa ! progress  ;Dbut 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  :Dtime to break my brain on the next steps  :P Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.