dynamic led

Moderator: Benj

Post Reply
donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

dynamic led

Post by donald »

Hello,
The Flowcode can simulate the illumination of a led between two ports ?
I have here a flowchart where I want to light up 3 leds one after another.
Attachments
dynamic led.fcf
(19.91 KiB) Downloaded 259 times

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: dynamic led

Post by Enamul »

Yes you can. I have seen your program but in the figure there is no current limiting resistor..you have to add current limiting resistor for LEDs. You can use port mask pin commands to run LED rather than bit wise command.
Enamul
University of Nottingham
enamul4mm@gmail.com

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

Hi Enamul,
I have not made resistor to limit current to that they are in the stage of simulation,
but I don't know how to do the flowcode simulation.
Can you show me in flowchart?

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: dynamic led

Post by Enamul »

Hi,
Click in the play button in the menu...as shown in the picture
Attachments
menu.PNG
(5.78 KiB) Downloaded 5206 times
Enamul
University of Nottingham
enamul4mm@gmail.com

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

Enamul not, I don't think you understand, if you look in the flochart the three leds do not light up
one after another, this means that leds have a reference point to the ground and I want to light up
between ports and not towards the ground.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: dynamic led

Post by Enamul »

Ok..I got now your points..in FC LEDs are simulated in respect of GND and you will not be able to get that what you are looking for..In that case you need to have facility to assign anode and cathode terminal separately but FC doesn't allow you to do that. I think no PIC simulator allow you this. Obviously you can get that in hardware..
Attachments
dynamic led.fcf
slightly modifies your code
(19.25 KiB) Downloaded 245 times
Enamul
University of Nottingham
enamul4mm@gmail.com

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

Led to the port (A1) and (A2) light up simultaneously on breadboard, why is that?
Attachments
dynamic led v.2.fcf
(19.24 KiB) Downloaded 242 times

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: dynamic led

Post by Enamul »

Sorry..I made some mistake in hex value...now it should be fine
Attachments
dynamic led.fcf
(19.22 KiB) Downloaded 250 times
Enamul
University of Nottingham
enamul4mm@gmail.com

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

It works now, you have been of help,thank you that you have occupied the matter.

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

Hi,
Led 5 illuminated simultaneously with led 2,
I can't turn off led 2.
Attachments
dynamic led v.3.fcf
(8.5 KiB) Downloaded 261 times

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: dynamic led

Post by petesmart »

Hi Donald,

is this what your looking for... i set all of the LEDs to off at the start of the loop, it now cycles around with all LEDs off to begin the sequence.

I hope i have understood your requirement

all the best

Pete.
dynamic led v.4 (1).fcf
(13 KiB) Downloaded 244 times
sorry about that Chief!

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: dynamic led

Post by medelec35 »

The problem your facing is because your using LED's connected to two pins rather than one pin and a supply.
Your using pins as i/p and o/p as you will need the pins to have 3 states.
1) O/P = High
2) O/P = Low
3) Tristate = configured as i/p

As Enamul stated Flowcode will not be able to simulate that.

If you would like to post a circuit diagram of how your LEDS are connected, then a working flowchart can be produced for you.

However its not worth running flowchart simulator as you may not think its going to work, as it will only work on your hardware.

So please (if not already done so) only test on hardware before stating if all is working ok or not

Martin
Martin

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

Hi Pete,
I set all leds to zero and behaves the same way I stated above.
You can set port A0 inactive?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: dynamic led

Post by medelec35 »

Hi donald, Just edited my post at the same time you posted.
I just added:
medelec35 wrote: Your using pins as i/p and o/p as you will need the pins to have 3 states.
1) O/P = High
2) O/P = Low
3) Tristate = configured as i/p


Thanks
Martin

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

Hi Martin,
Yes that's right i have posted almost at the same time. I have to come back with a scheme,
I have seen that it is functioning, it is purchased and leds are connected between the two ports.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: dynamic led

Post by medelec35 »

If you got no means of creating a schematic , then just state something like:

LED1
a = portB0
k = portB1

LED2
a = portB1
k = portB0

LED3
a = portB0
k = 0V

etc
Martin

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

Hi Martin,
That's pretty much the way it would be drawing if I am right.
Attachments
sch.png
(26.78 KiB) Downloaded 5161 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: dynamic led

Post by medelec35 »

Hi donald,
Hopefully I have got LED 1 - 4 correct
Only completed 4LEDs because1)
May not be correct and 2) just to give you an idea on how to do it if all works.

IMPORTANT: You must connect a 220R limiting resistor in series with each pin of port and pair of diodes.

Martin
Attachments
dynamic led v.4.fcf
(14.44 KiB) Downloaded 171 times
Martin

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

Hi Martin,
Thank you very much, I would play less than to see how it works.

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: dynamic led

Post by donald »

Hello to all over the world,
Mr. Martin will be thank you for your help and solve excellence of the question.
Also thank Enamul and Pete.
All the best!

Post Reply