![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
He (the OP) already referenced your site and this project in his first post...
Mike |
|
|
|
|
|
|
(permalink) |
|
O nice, i missed that link in the text
__________________
Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Nice demo, as always. My only 'nit' would be to use a shadow variable to prevent turning on the LEDs when they have a duty cycle of 0. Updating the output latch from the shadow also produces consistant duty cycle durations. Your example (and another forum members example) will produce different "on times" for the three colors when they have been set to the same duty cycle. Of course this is not important in the context/scope of your very nice demo. Mike Code:
;
; Dim red, grn, blu As Byte ' duty cycle, 0..255
; Dim dcy As Byte ' duty cycle counter, 0..255
; Dim shadow As Byte '
;
; Interrupt rgb_interrupt()
; t0if = 0 ' clear timer0 interrupt flag
; inc(dcy) ' increment duty cycle
; if dcy = 0 ' if new period
; shadow = %01110000 ' set RC6..RC4 shadow bits
; endif '
; if red = dcy then '
; shadow.bit6 = 0 ' turn off RC6 shadow bit
; endif '
; if grn = dcy then '
; shadow.bit4 = 0 ' turn off RC4 shadow bit
; endif '
; if blu = dcy then '
; shadow.bit5 = 0 ' turn off RC5 shadow bit
; endif '
; LATC = shadow ' update port from shadow
; End Interrupt
;
rgb_interrupt ; 14 words
bcf INTCON,T0IF ; clear timer 0 interrupt flag
movlw b'01110000' ;
infsnz dcy,F ; new period? no, skip, else
movwf shadow ; set led bits in shadow
movf dcy,W ; wreg = duty cycle, 0..255
cpfsgt red ; (F) - (W), skip if (F) > (W)
bcf shadow,6 ; clear bit if (F) <= (W)
cpfsgt grn ; grn - dcy, skip if grn > dcy
bcf shadow,4 ; clear bit if grn <= dcy
cpfsgt blu ; blu - dcy, skip if blu > dcy
bcf shadow,5 ; clear bit if blu <= dcy
movff shadow,LATC ; update port c from shadow
retfie FAST ;
Last edited by Mike, K8LH; 8th June 2008 at 02:05 PM. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
||
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
|||
|
|
|
|
|
(permalink) |
|
I apologize for picking 'nits'. No one could possibly perceive the timing difference. Also happy to contribute in a very small way to your very "shiny" site.
Please note that I reversed the bit polarity in my previous example but I'm sure you already figured that out. Regards, Mike |
|
|
|
|
|
|
(permalink) | |
|
Quote:
I have it cycling thru all 16.7milion colors now. Takes forever!
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
||
|
|
|
|
|
(permalink) | |
|
Quote:
(i'm in a bad mood today... sry)
__________________
Best Regards, Tiago Silva. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
I also like to figure everything out before I buy something so I can do it with minimal frustration. Here is my updated schematic. If you guys see anything, let me know! I can't thank you enough for all of your help everyone! ![]() |
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| LEDs | RayH | General Electronics Chat | 33 | 12th June 2008 08:10 PM |
| 180 leds! | justDIY | Electronic Projects Design/Ideas/Reviews | 4 | 8th February 2007 05:46 PM |
| LEDs | zachtheterrible | Electronic Projects Design/Ideas/Reviews | 25 | 5th October 2004 03:41 PM |
| RGB LEDs with PWM?? | seahkw | Micro Controllers | 2 | 27th August 2004 01:30 AM |
| LEDs-Super Bright White LEDs $1.35USD ea | ssullivan777 | Datasheet/Parts Requests | 0 | 27th February 2003 02:02 AM |