LED Charlieplex Error [solved]

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8376
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2384 times
Been thanked: 3415 times
Contact:

LED Charlieplex Error [solved]

Postby medelec35 » Mon Jan 22, 2018 9:05 am

Error on compile:

Code: Select all

Description:   
Device:        PIC.12F.12F1840
Generated by:  Flowcode v7.3.0.6
Date:          Monday, January 22, 2018 07:56:52
Users:         1
Registered to: Martin
Licence key:   BA48R5
http://www.matrixtsl.com
Errors when generating C source code:
FC1.c : 647 : error : Unknown or missing port variable: $PORTB.0
FC1.c : 653 : error : Unknown or missing port variable: $PORTB.1
FC1.c : 659 : error : Unknown or missing port variable: $PORTB.2
FC1.c : 671 : error : Unknown or missing port variable: $PORTB.3

FINISHED

ports assigned:
CharlieP1.png
CharlieP1.png (50.28 KiB) Viewed 1198 times
Attachments
FC1.fcfx
(14.05 KiB) Downloaded 18 times
These users thanked the author medelec35 for the post:
Benj (Mon Jan 22, 2018 11:19 am)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
Benj
Matrix Staff
Posts: 14219
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4361 times
Been thanked: 4096 times
Contact:

Re: LED Charlieplex Error

Postby Benj » Mon Jan 22, 2018 11:25 am

Hi Martin,

Thanks for letting us know. I believe I have now solved the problem with this modified component.

led_charlieplexed.fcpx
(128.11 KiB) Downloaded 26 times


Unused pins are now tied to Pin 0 and so should always be valid.
These users thanked the author Benj for the post:
medelec35 (Mon Jan 22, 2018 11:46 am)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8376
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2384 times
Been thanked: 3415 times
Contact:

Re: LED Charlieplex Error

Postby medelec35 » Mon Jan 22, 2018 11:46 am

Thanks Ben,
I can confirm that flowchart compiles ok.
The other issue regarding this is how to match the hardware with software.
As I have chose 4 pins (12LEDs) I'm looking for a diagram which will match LED1 on flowchart with LED1 on a circuit diagram ect.
Can the diagrams with LEDs numbered and matching pins be added to wiki?

Martin
These users thanked the author medelec35 for the post:
Benj (Mon Jan 22, 2018 11:48 am)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
Benj
Matrix Staff
Posts: 14219
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4361 times
Been thanked: 4096 times
Contact:

Re: LED Charlieplex Error

Postby Benj » Mon Jan 22, 2018 12:06 pm

Thanks Martin,

I'll get something like this uploaded to the wiki.

charliplex.jpg
charliplex.jpg (91.65 KiB) Viewed 1179 times


I believe the rule is that the LED connections stay as was from the last pin count say from 3 pins to 4 pins and then add the extra LEDs starting from pin0 and working your way through.
These users thanked the author Benj for the post:
medelec35 (Mon Jan 22, 2018 12:43 pm)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8376
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2384 times
Been thanked: 3415 times
Contact:

Re: LED Charlieplex Error

Postby medelec35 » Mon Jan 22, 2018 12:44 pm

Perfect!
Thanks Ben.
Will try it and let you know how I get on.
These users thanked the author medelec35 for the post:
Benj (Mon Jan 22, 2018 6:08 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8376
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2384 times
Been thanked: 3415 times
Contact:

Re: LED Charlieplex Error

Postby medelec35 » Mon Jan 22, 2018 9:55 pm

Hi Ben,
I can confirm that the 4 pin 12 LED version works 100% on 12F1840.
The version I posted required 1ms delay in between each LEDOn component.

Martin
These users thanked the author medelec35 for the post:
Benj (Tue Jan 23, 2018 11:01 am)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
Benj
Matrix Staff
Posts: 14219
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4361 times
Been thanked: 4096 times
Contact:

Re: LED Charlieplex Error

Postby Benj » Tue Jan 23, 2018 11:14 am

Thanks Martin,

That's brilliant thanks for letting us know. Glad it works nicely, do you think the delay should be added to the component to save you having to add it yourself?

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8376
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2384 times
Been thanked: 3415 times
Contact:

Re: LED Charlieplex Error

Postby medelec35 » Tue Jan 23, 2018 11:24 am

Glad I can help.
If you did add a delay, then It would be best to add a new parameter so you can specify as delay time in microseconds or milliseconds.
Reason for the choice is you may wish to dim the leds.
If not easy to do that then I believe it's best to add delay manually.
These users thanked the author medelec35 for the post:
Benj (Tue Jan 23, 2018 12:35 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.