Jump to content

Blinking LEDs


LX
 Share

Recommended Posts

Hi all

I have a question about blinkig LEDs with some interval.

I can't find where is place in main.asm for make it this.

I thing that mabye is in USER_Timer but I dont know how to do it.

Have you any ideas?  :'(

Thanks for reply

Best Regards

LX

Link to comment
Share on other sites

Hi,

ask MTE. He had to implement some blinking led in his box too. But I dont know if he found a way to do, cause the only command which can be used is MIOS_Delay (sais MTE... don't know if theres another cmd) what delays all operation and not just one dout.

Does it have to be softwareside blinking ? If not, you can build a blinking led with a little timer ic. nothing big. Search google.

greetz

Link to comment
Share on other sites

Hi

if you want the timer to do this

*first step is to initialise the timer, call  MIOS_TIMER_Init

(see http://www.ucapps.de/mios_fun.html for more info on how to use this function)

*next put your blink code in USER_Timer

do you have experience with assembler coding?

otherwise it would be easier to do this in C

let me know if you need more hints

Link to comment
Share on other sites

I wanted the same thing for my LEDs once, and I had idea of doing this hard way - 555 or something. It is definitly much better to do it using software if you know how, but I don`t :-\ You can also try blinking LEDs, but you can`t change the intervals.

Link to comment
Share on other sites

  • 2 weeks later...

Hi

;D !!! success !!! 8)

It's functional...

I use timer with period about 25ms and filtering every 8th cycle. -> ideal blinking.. :D

I have finished flashing clips in Ableton Live and it function like the program.

I use incoming 4 mesages 7E, 7F, 01, 00 from clip. When I switching clips on PC, midibox LEDs are same like Live.  :)

B.R. LX

Link to comment
Share on other sites

in assembler... ;)

I must tune this code, becouse i found 3 mistakes at some special combination of switching clips  :-\

But it's 1-2 days debugging  :)

Than I'll make video of this..and share code  ;)  (but it is quite secial for my Buttons module) -> only for your help  :)

B.R. LX

Link to comment
Share on other sites

  • 3 weeks later...

mission complete!!!

my code is quite complicated  ???

I put there steps for easy blinking...

1) timer initialization - I place this to USER_Init (but,you can start or finish timer any time)

    movlw	31250 & 0xff		
    movwf	MIOS_PARAMETER1		
    movlw	31250 >> 8			
    movwf	MIOS_PARAMETER2		
    movlw	0x03				
    call	MIOS_TIMER_Init
timer jump to USER_Timer every 25ms from now 2) You must write this definition on the top of main.asm (determine count of skips then blinking routine will be perform)
#define LX_CLIPS_BLINKING_SPEED 8          ; 6=quickly  8=mediumly  10=slowly
3) USER_Timer     -----------
USER_Timer

; This is for erase speed interval...
        movf	LX_BL_Clock, W				
	sublw	LX_CLIPS_BLINKING_SPEED		
        skpnz							
        clrf      LX_BL_Clock

; if LX_BL_Clock = 0 go to  LX_PrePlay_BL routine... 
        movlw	0x01
        subwf	LX_BL_Clock, W
        skpc									
	rgoto	LX_PrePlay_BL
	rgoto	LX_Timer_End

LX_PrePlay_BL
     
	IFCLR	LX_BL_Enable, 0, rgoto LX_Timer_End

	IFSET	LX_BL_Switch, 0, rgoto LX_LED_PrePlay_On

LX_LED_PrePlay_Off
; >> ------------------ LED Off ------------------
	movf	LX_Blinking_Button, W
	call	MIOS_DOUT_PinSet0
	bsf	    LX_BL_Switch, 0
	rgoto	LX_Timer_End
; << ------------------ LED Off ------------------

LX_LED_PrePlay_On
; >> ------------------ LED On ------------------
	movf	LX_Blinking_Button, W
	call	MIOS_DOUT_PinSet1
	bcf	    LX_BL_Switch, 0
; << ------------------ LED On ------------------

LX_Timer_End
	incf	LX_BL_Clock, F			

return

registers

LX_BL_Switch - if bit D0 is 0/1=On/Off LED

LX_BL_Enable - if D0 is 0/1=disable/enable blinking

LX_Blinking_Button - into save number of button

I finish today...  :-\

B.R. LX

5.3.2007 - sorry, I must edit this reply today (code was wrong)  :-\

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...