Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 25th March 2009, 03:46 PM   #136
Default

No need to clear the shadow variable when you're shifting 8 new bits into it each interrupt, yes, no?

Last edited by Mike, K8LH; 25th March 2009 at 05:50 PM.
Mike, K8LH is online now  
Old 26th March 2009, 04:02 AM   #137
Default

Hi Mike I studied your program its very clever.I have a problem.I'm using 4Mhz not 8Mhz.

I adjusted your program Is this settings ok?

XT = 4Mhz
Interrupts = 100uS
Levels = 100
Frame Rate = 10000uS = 10mS
PWM Frequency = 100Mhz

Whats the advantage using higher PWM frequency Mike? Is 60 PWM frequency do you recommend?
Suraj143 is offline  
Old 26th March 2009, 04:43 AM   #138
Default

Hi Suraj,

Those settings look fine and a 100 Hz refresh rate should be fine.

The only advantage for using a higher refresh rate is that you would be able to update the LED array at shorter intervals. You can update the array at 5 msec intervals with the 200 Hz rate or update the array at 10 msec intervals with the 100 Hz rate.

Did you test your modified program?

Mike

Last edited by Mike, K8LH; 26th March 2009 at 04:50 AM.
Mike, K8LH is online now  
Old 26th March 2009, 04:51 AM   #139
Default

Hi Mike, K8LH I've completed the code now I have to make it & see.I'll tell you the progress.

When I extend the pwm levels like (200 levels) the PWM frequency drops down like 50Hz.Is this good?Will it get unsmoother?

Last edited by Suraj143; 26th March 2009 at 04:55 AM.
Suraj143 is offline  
Old 27th March 2009, 04:01 AM   #140
Default

Hi Mike, K8LH last night I checked on a real hardware your code worked perfectly.You need to uncomment that (xorlw 0ffh) after that it worked.I'm really really happy now.Thanks again for the support.

Can I use the maximum brightness value 100 instead of 99?

Now everything is ok reloading the LED variables I'm doing with a lengthy way.I like to use your method using a macro.

Can I use "Setled 00,00,99,66,20,12,04,01" to load the brightnesses?Or do I have to write a macro to load them?(I never used macros)
Suraj143 is offline  
Old 27th March 2009, 11:19 AM   #141
Default

Hi Suraj,

Happy to hear your software/hardware is working.

Yes, you can use pwm values of 100.

You need to create a macro for that "Setled 00,00,99,66,20,12,04,01" functionality. The macro needs to be placed ahead of the code that uses it within the source file. Many people place it ahead of the code section.

Code:
setled  macro   p0,p1,p2,p3,p4,p5,p6,p7
        movlw   p0              ; pwm value 0..99
        movwf   led+0           ; led[0] = p0
        movlw   p1              ; pwm value 0..99
        movwf   led+1           ; led[1] = p1
        movlw   p2              ; pwm value 0..99
        movwf   led+2           ; led[2] = p2
        movlw   p3              ; pwm value 0..99
        movwf   led+3           ; led[3] = p3
        movlw   p4              ; pwm value 0..99
        movwf   led+4           ; led[4] = p4
        movlw   p5              ; pwm value 0..99
        movwf   led+5           ; led[5] = p5
        movlw   p6              ; pwm value 0..99
        movwf   led+6           ; led[6] = p6
        movlw   p7              ; pwm value 0..99
        movwf   led+7           ; led[7] = p7
        endm

Last edited by Mike, K8LH; 27th March 2009 at 11:23 AM.
Mike, K8LH is online now  
Reply

Tags
boostc, charlieplexed, pwm

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
BoostC question.. AddressOf Mike, K8LH Micro Controllers 8 25th June 2008 12:20 AM
LCD degree symbol with sprintf (BoostC) futz Micro Controllers 29 5th June 2008 05:19 AM
math.h and lib for BoostC? futz Micro Controllers 3 31st March 2008 06:29 AM
Charlieplexed code segment for the Cricket Thermostat William At MyBlueRoom Micro Controllers 2 14th March 2006 05:12 PM
My PIC Projects Site NEW (includes 2 Charlieplexed Display) William At MyBlueRoom Electronic Projects Design/Ideas/Reviews 0 28th February 2006 02:31 PM



All times are GMT. The time now is 02:59 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker