Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

software PWM

MrDEB

Well-Known Member
When I get the correct resistor arrays I hope to test this out. note the blue resistors will be "multiplexed so no two leds will be on at the same time. same goes for the white leds.
 

For The Popcorn

Active Member
When I get the correct resistor arrays I hope to test this out. note the blue resistors will be "multiplexed so no two leds will be on at the same time. same goes for the white leds.
That sentence makes ZERO sense, since two LEDs in parallel must be on any time a port pin is asserted.

I think perhaps you meant that ALL of the LEDs will never be on at the same time. That's a bit curious statement to make, since I showed in post #27 that even with all LEDs illuminated, the current draw will be less than the maximum the PIC18F can support. But I've noticed from some of your other posts, you don't let yourself get bogged down in details of replies to your posts.

The long and short of it is that you don't have to sweat it if all the LEDs are illuminated for brief periods as you're developing code; obviously, the LEDs won't all be illuminated all the time. If that were the case, hopefully you'd just eliminate the micro all together.
 

Pommie

Well-Known Member
Most Helpful Member
ALL the same colour LEDs could each have a resistor and be paralleled and switched with a single NPN driven through one pin. You could even use one (of several) PWM modules. Edit, and an 8 (or 14) pin chip.
hopefully
Live in hope. Not gonna happen. :rolleyes:

Mike.
 

MrDEB

Well-Known Member
well I got my 330 ohm resistor arrays in 1206 pkg but not right ones.
turns out using the EASYEDA program I picked the wrong sized resistor array.
It is an odd size = 5.3mm x 3.10mm
searched Octapart, Digikey, Mouser etc. Nobody has any until May or June..
Put this on hold but never realized different sized arrays.
 

For The Popcorn

Active Member
What footprint did you use in EasyEDA? Did you happen to note the stock at LCSC (shown at the bottom of the screen when you click on it after a search)?

Did you check stock at LCSC? They probably have stock which might let you get this working by Christmas.
 

MrDEB

Well-Known Member
I checked and all they had were 100 ohm, not 330. The part number is C149872
I want to check if an 805 footprint componet will work?
 

Pommie

Well-Known Member
Most Helpful Member
That array consists of four 1206 resistors according to the datasheet. When you select something in the library, you can go to "More->View Datasheet" to open the datasheet. Note that 3.1mm is 0.12inches. They have single 220R 1206 resistors as C352117.

Mike.
 

For The Popcorn

Active Member
I checked and all they had were 100 ohm, not 330. The part number is C149872
I want to check if an 805 footprint componet will work?
If you search on C149872, which is the part number for a 100 ohm resistor, guess what you'll find?

The illustration shows the footprint vs. the part number and resistance.

footprint.jpg
 

For The Popcorn

Active Member
Look at part number C240732 at LCSC.com. They have over 6700 in stock at 3 cents a piece. See the picture.

1205 dim.jpg
 

MrDEB

Well-Known Member
that looks promossing. Wonder if shipping costs are high compared to Mouser or Digi-key? thanks will investigate
 

For The Popcorn

Active Member
Hope isn't the best strategy. You can read the dimensions of the part from the datasheet, and you can determine the dimensions of the footprint from EasyEDA.. It's not difficult to know that they will work.

Of course, the best bet is to select the proper value, available parts when laying out the schematic. With EasyEDA, you'll know with almost 100% certainty that the footprint is the correct one to go with the component.
 

MrDEB

Well-Known Member
I really like Diptrace since I am familiar with it. Plus (not sure if Easyeda csan print finished layout) but I prrint out using 100% the pcb layout with all the footprints. Then just lay componets on the printout and instantly see if compenet fits.
This works well for confihuring the enclosure mounting holes etc.
As for the resistor arrays issue, was not aware that the footprint would be larger that a 1206 footprint.
 

MrDEB

Well-Known Member
sorry to inform you but it is not.
the footprint is 5.3 x 3.1
the resistors are 805
I have lots of arrays that are 1206 but the easyeda designed boards were suspossed to be a 1206 resistor array but the pattern is to long and wide.
 

Pommie

Well-Known Member
Most Helpful Member
Must be a coincidence that 0.12 inches is 3.1mm. If they were 0805 then the package would be 0.08x25.4=2mm.

Mike.
 

For The Popcorn

Active Member
I have lots of arrays that are 1206 but the easyeda designed boards were suspossed to be a 1206 resistor array but the pattern is to long and wide.

The footprint on the circuit board is the correct package for the resistor network YOU specified in the schematic. There are several configurations that are different sizes and you happened to select the less-common size.

resistor network package.jpg

It's the same as four 1206 footprints as it contains four resistors.

Mike.

No, actually it's not the same as four 1206 resistors side-by-side, or even 0805s.
 

Pommie

Well-Known Member
Most Helpful Member
No, actually it's not the same as four 1206 resistors side-by-side, or even 0805s.
No, it's just the same length as a single 1206 but not as wide as four single 1206s due to the fact it's an array. If we convert 1206 to metric we get 3.1 X 1.65. Four next to each other (touching) will be 3.1 x 6.2 - the same height and only 0.9 mm longer (or wider if you prefer) than the package dimensions.

Mike.
 

MrDEB

Well-Known Member
UPDATE I finally received the correct 330 ohm resistor arrays
completed assembly and now to configure sort of software PWM (dim all the white LEDs then gradually regress to full brightness)
been hacking at a short bit of code experimenting with different DELAY.
my goal is to have two or three different dimming sequences.
when all the DELAYS are set to 100 it has a shimmering effect which will be one subroute.
trolling for different ideas on different effects. going to have to change port settings since the white LEDs are not all on same ports (blue and white are mixed between the 5 ports this posted code is experimental to determine different DELAYS. My thought was use CONSTANT arrays BLUE & WHITE then designate using %00011000 for the different port designations
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2022 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 5/18/2022                                                      *
*  Version : 1.0                                                            *
*  Notes   : 70 total LEDs blue and white                                                               *
*          : thoughts to improve = add a counter and increase then decrease
           : the delay just for one color  = white?                                                               *
*****************************************************************************
}
'Program: CHRISTMAS STAR:

Device = 18F43K22
Clock = 8

// int osc and IO pin libraries
Include "intosc.bas"
#option DIGITALIO_INIT = true       // automatically call setalldigital
Include "setdigitalio.bas"

// hardware
DIM Counter AS WORD
dim Counter_up as word
dim Counter_down as word
Dim m As Byte
Dim w As Byte
Dim x As Byte
Dim y As Byte
Dim z As Byte
{
Dim LED0 As PORTA.0
Dim LED1 As PORTA.1
Dim LED2 As PORTA.2
Dim LED3 As PORTA.3
Dim LED4 As PORTA.4
Dim LED5 As PORTA.5
Dim LED6 As PORTA.6
Dim LED7 As PORTA.7

Dim LED8 As PORTB.0
Dim LED9 As PORTB.1
Dim LED10 As PORTB.2
Dim LED11 As PORTB.3
Dim LED12 As PORTB.4
Dim LED13 As PORTB.5
Dim LED14 As PORTB.6
Dim LED15 As PORTB.7

Dim LED16 As PORTC.0
Dim LED17 As PORTC.1
Dim LED18 As PORTC.2
Dim LED19 As PORTC.3
Dim LED20 As PORTC.4
Dim LED21 As PORTC.5
Dim LED22 As PORTC.6
Dim LED23 As PORTC.7

Dim LED24 As PORTD.0
Dim LED25 As PORTD.1
Dim LED26 As PORTD.2
Dim LED27 As PORTD.3
Dim LED28 As PORTD.4
Dim LED29 As PORTD.5
Dim LED30 As PORTD.6
Dim led31 As PORTD.7

Dim led31 As PORTE.0
Dim led32 As PORTE.1
Dim led33 As PORTE.2
}
 
//-------------------------------------
// start of main program
//-------------------------------------
main:
// init hdw
               // LED port - all outputs 2 LEDs per port in parallel 330 ohm resistor
trisa = 0
trisb = 0
trisc = 0
trisd = 0
TRISE = 0
counter = 100
counter_up = 150
counter_down = 150
setalldigital
While true
For m = 0 To 7
for z = 0 to 2
    PORTE.bits(z)=1       // only 3 pair of LEDS
    DelayuS(counter)
    PORTE.bits(z)=0
    DelayuS(counter)
    
     porta.bits(m)=1
     portb.bits(m)=1
     portc.bits(m)=1
     portd.bits(m)=1
     delayus(counter_up)
     porta.bits(m)=0
     portb.bits(m)=0
     portc.bits(m)=0
     portd.bits(m)=0
     delayus(counter-10)
    'counter_up = (counter_up - 10)
    'if counter_up <100
    'then
    'counter_down = (counter_down+10)
    'end if
 next
 next
 Wend
 

Latest threads

Top