PCB Heaven

General Category => Your projects => Topic started by: Colonel Shofer on October 03, 2011, 03:57:20 AM

Title: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on October 03, 2011, 03:57:20 AM
Howdie,

First post (apart from WHOIS) !!! Great site.

I am wanting to modify the 'LED sequencer circuit', from here, to drive four LEDS on each channel (actually, it is just 4x3, maybe 4 x 4), as in the Helicopter Pad YT video, shown here ...

http://colshofer.blogspot.com/search/label/Landing%20Pad

Could you please tell me, if the extra LEDs can be added, in parallel, or do I have to be more careful and complicated ... which is fine, so long as I know how :) (I realise I may need more resistors, at least).

Cheeky to ask for a circuit diagram? But you may love making them ;)

TYIA

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on October 03, 2011, 20:57:28 PM
do you have a circuit diagram for this specific circuit? Maybe you do not need to add anything. But it is generally advised to use a common collector transistor to amplify the current to your needs.

The output of the circuit goes through a resistor (eg 470 Ohms) to the base of a NPN transistor (such as BC548). The collector of the transistor is connected to the power supply (3 or 5 volts whatever). From the emitter, 4 lines will depart, one for each LED. Also, each LED must have its own resistor. So, you want 4 leds? you need 4 resistors. The resistor has to do generally with the brightness of the LED. You will use the same resistor like the one that has the 1 led you currently have.
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on October 03, 2011, 21:06:47 PM
TY,

Great start :) ... I am buying a PIC programmer/debugger this (or next month, from Ebay (USA)) (best price on the 'ICD2.5 Debugger USB MPLAB PIC', thoughts please?), so I will practise with the transistors, first, and build the LEDS into the pad. I will create a schematic, for the circuit, too.

TY again.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: _pike on October 03, 2011, 22:27:05 PM
I use pickit3 (clone) and i am very very pleased!!!!!! I bought for 20$ from e-bay with a zif socket it was on sale......


http://www.ebay.co.uk/itm/PICKIT-3-MCU-Universal-ZIF-socket-PICkit-2-3-ICD2-/350494272919?pt=LH_DefaultDomain_0&hash=item519b162d97
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on October 05, 2011, 21:12:49 PM
TY friends,

Got me well on the way ...

Landing Pad (Part 4)
http://colshofer.blogspot.com/2011/10/landing-pad-part-4.html (http://colshofer.blogspot.com/2011/10/landing-pad-part-4.html)

Time to get the kit ordered :)

TY again (for now :) ).

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on October 05, 2011, 23:08:41 PM
"I use pickit3 (clone) and i am very very pleased!!!!!! I bought for 20$ from e-bay with a zif socket it was on sale...... "

TY _p, could you (and all) please take a look at these ...

http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=350451573518&ssPageName=ADME:X:EAC:GB:1120

http://www.ebay.co.uk/itm/360098312778?ssPageName=STRK:MESINDXX:IT&_trksid=p3984.m1436.l2649

http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=350496407264&ssPageName=ADME:B:WNARL:GB:1123

... and give me a quick review of which one (inc yours) is 'better' and why? - I may buy a couple ;)

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: _pike on October 06, 2011, 00:26:29 AM
Avoid buying icd2 its VERY OLD,and cannot communicate with newer chips.The main difference between them is the debuging procedure.They say that it is more faster (icd2 from pickit2).(I haven't test it)I was teached to try to find my programming errors by myself and not by the debugger, and believe me you learn better!!!!.Now if you are still intrested of buying icd series i would recommend you to see the icd3 but i still insist to buy pickit3.Your final decision is yours....... ;)
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on October 06, 2011, 07:58:34 AM
pickit has also programming on the go, you can load a program on the pickit, take it with you and then upload the program on a pic without a PC. the only thing that looks bad on pickit is the connector, which is not a standard connector.  nothing to worry though.
Although icd can program LF pics normally (like pickit), icd cannot program low voltage pics such as the 24f series.
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: _pike on October 06, 2011, 14:07:23 PM
the only thing that looks bad on pickit is the connector, which is not a standard connector.  nothing to worry though.

kam i think that you are wrong...what kind of connector do you mean?The pickit3 i bought has 3 extra connectors the one like the telephone's plug the pin header to pin header and one more that i cannot remember right now and i will tell you later....(I am not at home.... ;) )
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on October 06, 2011, 22:55:41 PM
oh, when i saw it, i thought it had some kind of thin special connector, not an RJ style. Maybe i'm wrong.
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 08, 2011, 23:13:40 PM
Just wanted to say TY ...

http://colshofer.blogspot.com/p/with-electricity-we-will-win.html :)

(http://4.bp.blogspot.com/-AWW0ujz3o1E/TrRtzRoLmMI/AAAAAAAABjA/EHZVozGAti4/s320/100_1198.JPG)

Pickit3 and chips obtained, as recommended - TY.  Also getting a good price on an Arduino MEGA 2560 Kit, for all the bits and to explore that MPU route/programming, too.

Done a lot of reading, since I was last here, and your advice turned out to be tip-top - TY :)

Watch this space ;)

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: _pike on November 09, 2011, 00:22:32 AM
have a good programming experience with your brand new programmer!!!!! (now we have the same ;) ) Feel free to ask anything you might want.
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on November 09, 2011, 13:14:47 PM
i'm bit of a jealous here... everyone is having a pickit3 and i still use the ICD  :-\ :-\ :-\

i think i must pay a visit at ebay these days...
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 12, 2011, 23:06:21 PM
(http://2.bp.blogspot.com/-9QMUsgaoiF0/TrxQ_o8M2EI/AAAAAAAABm0/cO4K7iBgTiU/s320/LPcoded.JPG)

Hi all, just doing some simulations, on my project, and getting build errors on your LED sequencer .asm with Proteus and MPLAB.

Fancy having a look at the errors? I like to sort out (or at least understand !!!) all such issues, so that I may learn and proceed :)

TYIA

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on November 13, 2011, 00:37:40 AM
errors? what sort of errors?
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 13, 2011, 02:36:45 AM
TY.

Just need to say, I only had one LED out, as per your schematic, in the simulation, but that should not affect this stage, should it?

MPLAB Build output

*******

----------------------------------------------------------------------
Release build of project `J:\___LED Sequencer\Led Sequencer.disposable_mcp' started.
Language tool versions: MPASMWIN.exe v5.42, mplink.exe v4.40, mplib.exe v4.40
Sun Nov 13 00:27:46 2011
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F88 "Led Sequencer.asm" /l"Led Sequencer.lst" /e"Led Sequencer.err"
Error[113]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 3 : Symbol not previously defined (_config1)
Error[126]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 3 : Argument out of range (not a valid config register address)
Error[113]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 4 : Symbol not previously defined (_config2)
Error[126]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 4 : Argument out of range (not a valid config register address)
Warning[207] J:\___LED SEQUENCER\INIT_NORMAL.INC 1 : Found label after column 1. (bank1)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 9 : Symbol not previously defined (option_reg)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 10 : Symbol not previously defined (pie1)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 11 : Symbol not previously defined (pie2)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 12 : Symbol not previously defined (ansel)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 13 : Symbol not previously defined (txsta)
Error[113]   J:\___LED SEQUENCER\P16F88.INC 417 : Symbol not previously defined (status)
Error[113]   J:\___LED SEQUENCER\P16F88.INC 417 : Symbol not previously defined (rp1)
Error[113]   J:\___LED SEQUENCER\P16F88.INC 418 : Symbol not previously defined (status)
Error[113]   J:\___LED SEQUENCER\P16F88.INC 418 : Symbol not previously defined (rp0)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 15 : Symbol not previously defined (intcon)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 16 : Symbol not previously defined (ccp1con)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 17 : Symbol not previously defined (t1con)
Warning[207] J:\___LED SEQUENCER\INIT_NORMAL.INC 20 : Found label after column 1. (bank2)
Warning[207] J:\___LED SEQUENCER\INIT_NORMAL.INC 24 : Found label after column 1. (bank1)
Error[116]   J:\___LED SEQUENCER\INIT_NORMAL.INC 24 : Address label duplicated or different in second pass (bank1)
Warning[207] J:\___LED SEQUENCER\INIT_NORMAL.INC 29 : Found label after column 1. (bank0)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 31 : Symbol not previously defined (rcsta)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 32 : Symbol not previously defined (adcon0)
Warning[207] J:\___LED SEQUENCER\LED SEQUENCER.ASM 29 : Found label after column 1. (bank1)
Error[116]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 29 : Address label duplicated or different in second pass (bank1)
Warning[207] J:\___LED SEQUENCER\LED SEQUENCER.ASM 35 : Found label after column 1. (bank0)
Error[116]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 35 : Address label duplicated or different in second pass (bank0)
Error[113]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 38 : Symbol not previously defined (Carry)
Error[128]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 38 : Missing argument(s)
Error[113]   J:\___LED SEQUENCER\MSECDELAYS4MHZ.INC 38 : Symbol not previously defined (Zero)
Error[128]   J:\___LED SEQUENCER\MSECDELAYS4MHZ.INC 38 : Missing argument(s)
Halting build on first failure as requested.
----------------------------------------------------------------------
Release build of project `J:\___LED Sequencer\Led Sequencer.disposable_mcp' failed.
Language tool versions: MPASMWIN.exe v5.42, mplink.exe v4.40, mplib.exe v4.40
Sun Nov 13 00:27:48 2011
----------------------------------------------------------------------
BUILD FAILED

******

ISIS .ERR file content ....

******

Error[113]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 3 : Symbol not previously defined (_config1)
Error[126]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 3 : Argument out of range (not a valid config register address)
Error[113]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 4 : Symbol not previously defined (_config2)
Error[126]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 4 : Argument out of range (not a valid config register address)
Warning[207] J:\___LED SEQUENCER\INIT_NORMAL.INC 1 : Found label after column 1. (bank1)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 9 : Symbol not previously defined (option_reg)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 10 : Symbol not previously defined (pie1)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 11 : Symbol not previously defined (pie2)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 12 : Symbol not previously defined (ansel)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 13 : Symbol not previously defined (txsta)
Error[113]   J:\___LED SEQUENCER\P16F88.INC 417 : Symbol not previously defined (status)
Error[113]   J:\___LED SEQUENCER\P16F88.INC 417 : Symbol not previously defined (rp1)
Error[113]   J:\___LED SEQUENCER\P16F88.INC 418 : Symbol not previously defined (status)
Error[113]   J:\___LED SEQUENCER\P16F88.INC 418 : Symbol not previously defined (rp0)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 15 : Symbol not previously defined (intcon)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 16 : Symbol not previously defined (ccp1con)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 17 : Symbol not previously defined (t1con)
Warning[207] J:\___LED SEQUENCER\INIT_NORMAL.INC 20 : Found label after column 1. (bank2)
Warning[207] J:\___LED SEQUENCER\INIT_NORMAL.INC 24 : Found label after column 1. (bank1)
Error[116]   J:\___LED SEQUENCER\INIT_NORMAL.INC 24 : Address label duplicated or different in second pass (bank1)
Warning[207] J:\___LED SEQUENCER\INIT_NORMAL.INC 29 : Found label after column 1. (bank0)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 31 : Symbol not previously defined (rcsta)
Error[113]   J:\___LED SEQUENCER\INIT_NORMAL.INC 32 : Symbol not previously defined (adcon0)
Warning[207] J:\___LED SEQUENCER\LED SEQUENCER.ASM 29 : Found label after column 1. (bank1)
Error[116]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 29 : Address label duplicated or different in second pass (bank1)
Warning[207] J:\___LED SEQUENCER\LED SEQUENCER.ASM 35 : Found label after column 1. (bank0)
Error[116]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 35 : Address label duplicated or different in second pass (bank0)
Error[113]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 38 : Symbol not previously defined (Carry)
Error[128]   J:\___LED SEQUENCER\LED SEQUENCER.ASM 38 : Missing argument(s)
Error[113]   J:\___LED SEQUENCER\MSECDELAYS4MHZ.INC 38 : Symbol not previously defined (Zero)
Error[128]   J:\___LED SEQUENCER\MSECDELAYS4MHZ.INC 38 : Missing argument(s)

******

I am a novice, on PICs, in these sims.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 13, 2011, 03:13:17 AM
It looks like a case sensitivity issue ... but you must use MPLAB to compile and prog the chip, no?

http://www.microchip.com/forums/m580237-print.aspx
http://www.microchip.com/forums/m565801-print.aspx

TY

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: George on November 13, 2011, 03:41:07 AM
It is case sensitivity

look at http://pcbheaven.com/picpages/MPLAB-Starting_a_new_project/


Item 10 - disable case sensitivity in MPLAB

Step 10:
The "Buld options" dialog appears. Go to the tab labeled "MPASM Assembler" and make sure the checkbox "Disable case sensitivity" is checked. Then, click "Ok"

Cheers

George
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 13, 2011, 03:53:02 AM
Great George TY, worked in MPLAB.

Now, see if I can find how to do that in ISIS !!!  ideas?

Cannot even get ISIS to see the .hex file from MPLAB yet, even though it is pointed at it !!!

Cheers.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 13, 2011, 05:45:39 AM
OK, got the pic going in ISIS, with the .hex from MPLAB :)

Anyone ready to help me with the program for my LED layout, please? :)

TYIA.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on November 13, 2011, 21:55:45 PM
do you have a preliminary schematic in mind??????? like, for example, how the LEDs are supposed to light?
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 13, 2011, 23:20:48 PM
Hi K,

Yup, just on it now, TY :)

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 14, 2011, 00:19:55 AM
TY K,

OK, here is 'the spec' ...

(1) 4 'rings' of LEDS, each in parallel, for now, but will be optimising later.
(2) 1 blue ring, PWM (?) to pulsate.
(3) 3 red rings, Outer (O), Middle (M) and Inner (I).
(4) Sequence is O>M>I>O>M>I>O>M>I etc
(5) I will be running each ring, from a transistor, in reality.

My main problem (because I am a PICs programming newbie :) ), is how to get the blue ring pulsing, continuously, whilst the red rings sequence down from O to I.

Please excuse cludgy wiring :)

(https://lh6.googleusercontent.com/-LtEdR51eyD4/TsA_3d_gqaI/AAAAAAAABqQ/RczypEYu1os/s800/LPschemA.jpg)

(https://lh3.googleusercontent.com/-9QMUsgaoiF0/TrxQ_o8M2EI/AAAAAAAABm0/cO4K7iBgTiU/s400/LPcoded.JPG)

TYIA.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on November 14, 2011, 15:47:36 PM
is there any particular reason to use PIC? The circuit that you describe needs only a 4017 and a 555 (oh, and 4 transistors). See the attachment.

P.S. The 555 must be connected as an astable multivibator but i was too lazy to do it on the schematic. It is easy to do it. LEDs13 through 16 are the blue LEDs, and the others are the 4 LEDs on each "circle".
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 14, 2011, 17:58:06 PM
Hi K,

No, that is great TY ... a wonderful alternative which I will build too :)

How would I get the blues to pulsate (like this, I guess ... http://digiassn.blogspot.com/2009/03/electronics-pulsingbreathing-led.html ... another 555 ;) )?

The reason for PIC. is to learn how to prog and use PICS :)

Also, I do envisage more circuity connected to it, with different timings (and none) ... that is why I want to learn how to separately-control blue versus red, at different timings, turn on/off/pulsate independently, within PIC etc.

Even just a small example, with two reds and one blue LED (at different frequencies/on/off/pulsate) would be great, if you do not fancy the whole prog :)

Again, great, TY.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 14, 2011, 19:26:50 PM
Post above modified.

TY

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on November 15, 2011, 07:45:27 AM
yeap, you will need another 555.

as for the PIC, you can have 3 different pulsing rates like this:

Code: [Select]
MainLoop
 bsf Porta,0
 call Wait500mSec
 bsf Porta,1
 call Wait300mSec
 bsf Porta,2
 call Wait200mSec
 bcf Porta,0
 call Wait500mSec
 bcf Porta,1
 call Wait500mSec
 bcf Porta,2
 call Wait500mSec
 goto MainLoop

You will notice that you need 2 delay subroutines, one for 500mSec, one for 300 and one for 200. Either make them yourself, or download the "msecdelay16Mhz.inc" from one of my PIC projects.
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 15, 2011, 08:45:47 AM
Hi K,

The problem with the 555 circuits, that I can find, is that they only drive one pulsating LED, so until I can sort out PWM, via the PIC (lots for the Arduino !!! ;) ), I will have to settle for flashing blues.

TY for the code, I will try and get my head around it and get a simulation going.

Cheers.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on November 15, 2011, 19:31:41 PM
let me get this straight. you want pulsing or breathing? I mean, you want the leds to turn on-off, or to fade-in fade-out? Why you mention the PWM?
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 15, 2011, 20:04:31 PM
Hi K,

Sorry, to me ...

(A) pulsating = pulsing = breathing,
(B) flashing = on/off.

PWM is the technique used for (A), in the Arduino community, and I would like to learn how to implement it in the PIC domain (I have not seen it done) and with 4 blue LEDS !!!.

Cheers.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on November 16, 2011, 10:20:50 AM
Oh, i see. So you want to use PWM to control also the brightness. Well, Arduino-users use lots of PWM, because arduino has lots of PWM outputs. May PICs have PWM outputs, most of them limited to 1 or 2 channels, but you want at least 4 channels (3 for the circles and 1 for the blues). 16F1824 for example has 4 PWM channels, and 16F1527 has 10. Check them out using MIPS (http://www.microchip.com/productselector/MCUProductSelector.html).
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 16, 2011, 23:16:34 PM
TY K,

As it happens, I only want the blue ring to pulsate :) and wondered what the code/circuitry would be, see ...

http://picprojects.org.uk/projects/ledchaserpwm/
http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html

TY for the link, I just wondered if we knew how to PWM from the 16F88, already, just as in motors etc, to pulsate the 4 blue LEDs? I should be able to use the code(s) in the first link, above, to give it a go.

Cheers.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on November 17, 2011, 07:59:19 AM
the second link uses the internal pwm module of the pic. I use it quite often myself. Check my circuits with pic and pwm, for example this -http://pcbheaven.com/circuitpages/PWM_LCD_Contrast_Control/


Quote
            ;Setup PWM module
            bank1
            movlw 0x80
            movwf PR2         ; Period
            bank0

            movlw b'00000100'
            movwf T2CON
            movlw b'00111100'      
            movwf CCP1CON

The above code sets the PWM duty cycle and frequency. From that point, you can change the duty cycle only by changing the register CCPR1L. The output is at pin labeled CCP1.


As for the second link, it uses another technique. I suppose that the PIC runs manually PWM loops. Here is how it goes: You set a register with the total pwm period. Then, for each channel you set different duty cycle registers. Then you run the loop. At the beginning of the loop, you turn on all the outputs that have dc-register higher than zero. At every loop. you decrease all the dc-registers and the period register as well. If one of the dc registers becomes zero, then you turn the corresponding output off. Finally, when the period register becomes zero, you re-start the whole process.
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on November 17, 2011, 23:06:14 PM
TY K,

Super ... time to put my thinking (and building) cap on :)

Cheers and TY again.

CS.
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on December 05, 2011, 11:40:54 AM
TY again, we on-the-way ...

First programmed and working LED sequencer circuit
http://www.youtube.com/watch?v=GA_xvIHOKTw (http://www.youtube.com/watch?v=GA_xvIHOKTw)

Now to learn more (some !!!) programming, to try and work out how to pulse/breath an LED from one of the outputs, by PWM ... any ideas please? :(

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on December 05, 2011, 19:15:11 PM
you want to pulse each LED with different effect? i mean, all 4 leds will pulse together, or it will look like kitt? which pic you used?
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on December 06, 2011, 16:39:47 PM
Hi K,

Please see my schematic. I can now work on how to reduce the code, to only three pins and use transistors to drive the red 'rings' ...

(https://lh6.googleusercontent.com/-LtEdR51eyD4/TsA_3d_gqaI/AAAAAAAABqQ/RczypEYu1os/s800/LPschemA.jpg)

I only want the 4 *blue* LEDs to 'breath' (via a transistor, from one pin, I guess).

They should have a different (and programmable) 'breath' frequency, from the red LEDs, but, ideally, be able to match that frequency too, by programming.

So many pins, seems silly to waste them :)

As a newbie ... is it possible to have separate routine 'modules' like this, on different pins, in the same program? I am still trying to get my head around that concept (particularly timings for each 'module').

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on December 06, 2011, 18:38:39 PM
the pic you use has only 2 PWM channels, so you may have only 2 different pulsing frequencies/Duty cycles. Do you use charlieplexing to drive the LEDs? I cannot tell from the schematic. It is a bit mess.

This is what i would do: I would have 4 pins, one for each circle and one for the blue LED. Then, you can have software PWM to control each channel alone. This means of course that the PIC will be 100% occupied to do the PWM and the PWM only, but i think that this is not a problem for you. Here is the idea for the software PWM. Suppose that you have 4 channels at RB0, RB1, RB2 and RB3 ports.You will need a global counter (GlobalCounter) and 4 DC counters one for each channel (DC_1, DC_2 etc).

Code: [Select]

RestartPWM
 clrf GlobalCounter
 movlw d'128'
 movwf DC_1 ;50% duty cycle for channel 1

 movlw d'64'
 movwf DC_2 ;25% duty cycle for channel 2

 movlw d'192'
 movwf DC_3 ;75% duty cycle for channel 3

 movlw d'10'
 movwf DC_4 ;something else for channel 4

 bsf portb,0
 bsf portb,1
 bsf portb,2
 bsf portb,3

MainLoop
 decf DC_1,f
 btfsc zero
 bcf portb,0

 decf DC_2,f
 btfsc zero
 bcf portb,1

 decf DC_3,f
 btfsc zero
 bcf portb,2

 decf DC_4,f
 btfsc zero
 bcf portb,3

 incf GlobalCounter,f
 btfss zero
 goto MainLoop
 goto RestartPWM
 



Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on December 06, 2011, 23:04:34 PM
TY Z,

I will try to see if I can get it working on the simulator, first.

The three red rings are each in parallel and were to be driven from a transistor (3 pins).
The fourth blue ring was in parallel and was to be driven from a transistor (1 PWM pin).

May I ask for more details on ...

Quote
This means of course that the PIC will be 100% occupied to do the PWM and the PWM only

I do understand that you have made all the lines PWM, but, in general, does that not only apply to the 2 PWM pins, leaving the other pins independent, for their own 0/1 states or am I missing something?

TY

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on December 07, 2011, 07:37:27 AM
the 2 pwm pins are driven by the internal PWM module (hardware), which means that they can run PWM and still the pic can do other things. The solution i gave you can make all the outputs PWM, but the PIC will not be able to do anything else because it will be occupied by the PWM routine all the time.
Ok, you may be able to run some small parallel routines or work on some interrupts, but if they get too long, it will be observable to the LEDs
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on December 08, 2011, 14:43:10 PM
TY K,

Yes, I guessed interrupts may be the way forward, but I need to learn about those too :)

OK, will have a go at your routine, first, and see how that goes

TYVM

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: Colonel Shofer on January 23, 2012, 03:05:33 AM
Just a quick update ...

Landing Pad (Part 7)
http://colshofer.blogspot.com/2012/01/landing-pad-part-7.html

(http://1.bp.blogspot.com/-RcygM4eG2mk/TxyfDSUSr9I/AAAAAAAAB1I/psPe2b9iy9E/s400/100_1557b.jpg)

Code good enough, for now, to allow the model build ... then I will get more sophisticated on it :)

TY again.

CS
Title: Re: Landing Pad Project (modding the LED sequencer)
Post by: kam on January 23, 2012, 07:43:50 AM
cool!  8) 8)