JuneBug + LEDMUX

Status
Not open for further replies.
Hi All,

Without letting this thread creak on much longer I just thought I would test what I said in my previous message.

I have modified the macro slightly so it doesnt require any timing.

Code:
LED		macro	x,y                        ; MACRO LED <PORTA>, <TRISA>
		
		clrf	LATA                       ; Clear LATA
		movlw	y
		movwf	TRISA                      ; TRISA = y

		movlw	x
		movwf	LATA
		endm                                ; end macro

The macro differs from the previous code
  • Clears LATA
  • Resets the relevant IO (TRISA - previously it did this last)
  • Sets the relevant LATA

Running the following code produces a bright LED3 and LED5, LED4 is not lit at all which is the desired effect.

Code:
START
LED3	LED		b'01000000', b'00111111'
LED5	LED		b'10000000', b'01111110'
		
		goto	START

Having said all this, I am definitely NOT going to light the LED's this way. I will use Interrupts as suggested by FUTZ and Bill.


Thanks to all who contributed.

Mark
 
UTMonkey said:
I am definitely NOT going to light the LED's this way. I will use Interrupts as suggested by FUTZ and Bill.
Hey UTMonkey. One thing you may run into (I did when trying something with it) with that interrupt code of mine is that if you want to blink the LEDs very fast you'll get odd results as the speed of blinking starts to get too close to the interrupt display updates. Odd harmonics happen and LEDs blink for too short a period or don't light at all because they were on and off before their update came.

At that point you either have to crank up the interrupt rate (I would think it should be possible at 8MHz) or find another way to do it. At low blink rates or LEDs on all the time it works just fine.

I was trying to do my VR1/VR2 blinky program with the interrupt code above. Wouldn't work at all except at the lower speeds.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…