Problem LCD component (Solved)

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Problem LCD component (Solved)

Postby Crenwick » Tue May 13, 2014 11:23 am

Hi all,

I'm starting a beautiful project for my fish-tank where I want to program some light transitions of RGB stripes with a DS3231 RTC and an LCD to monitor the whole thing :)

When I test the LCD it's ok but when I add the RGB-led component (with the "tick" included in an interrupt) then the LCD is completely scrambled !

Simulation run's fine.

I tested on FC5 and it works. Am I doing something wrong or is there a problem in one of the two components ?

I added my test code.
Attachments
RGB.fcfx
(19.11 KiB) Downloaded 71 times
Last edited by Crenwick on Mon May 19, 2014 3:06 pm, edited 2 times in total.
Bernard

Flowcode 6 / EB006-V9

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Problem between RGBled and LCD component

Postby Crenwick » Wed May 14, 2014 8:26 am

Hello,

I did some comparisons between the c code output of the FCV5 and the FCV6 and all seems ok.
When I test the lcd module it's fine and when I test the RGBled module also. Only when I try to use the two on the same chart it goes wrong.

So I have a question about the delays ... Should it be possible that the FCI_DELAYBYTE_xx has some influence from the timer0 interrupt ?

I'm almost sure the problem comes from the lcd component (if lcd-macros interrupted then display goes wrong).


Regards,
Bernard

Flowcode 6 / EB006-V9

User avatar
LeighM
Matrix Staff
Posts: 1932
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 464 times
Been thanked: 658 times
Contact:

Re: Problem between RGBled and LCD component

Postby LeighM » Wed May 14, 2014 11:09 am

Hi
It does seem strange that you are seeing a difference between V5 and V6.
I’ve had a quick look and cannot yet see what the issue might be.
But a couple of ideas:
Attempting to update the LCD display every 10mS might be producing strange results.
It might be worth adding in an extra variable counter that increments in the loop, then put your LCD update code in an “if counter > 100” branch, and also reset the counter to zero.
That way your LCD will only update every second.
If that does not fix the problem, then try disabling the interrupt at the start of the LCD code and then re-enable it at the end, just to see if the interrupt is the problem.
Hope that helps
Leigh

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Problem between RGBled and LCD component

Postby Crenwick » Wed May 14, 2014 11:36 am

I tried a lower refresh with no success, when I disable the interrupt then the lcd works but the led output flashes (period of display is way to long for led update)
Bernard

Flowcode 6 / EB006-V9

User avatar
LeighM
Matrix Staff
Posts: 1932
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 464 times
Been thanked: 658 times
Contact:

Re: Problem between RGBled and LCD component

Postby LeighM » Wed May 14, 2014 12:04 pm

OK, thanks for the update. As you said, looks like it is an interrupt problem then.
I'll try and dig deeper.

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Problem between RGBled and LCD component

Postby Crenwick » Wed May 14, 2014 4:40 pm

I looked in the forums and found in FCV5 a mod made by Ben in the LCD component to change the ports to latches, I'm unable to check if this mod has also be done in the FCV6 component because since FCV6 components are now in .fcpx format and no more editable :(

Can you have a look ?

Here is the post : viewtopic.php?f=46&t=10725&start=25

Changed also title :wink:
Bernard

Flowcode 6 / EB006-V9

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Problem LCD component

Postby Crenwick » Mon May 19, 2014 7:53 am

@ Matrix Staff

Can you please check this component ? I'm blocked in my project due to this problem.

Sorry for the stress, I suppose you're all busy or maybe some colleagues are out of office :wink:
Bernard

Flowcode 6 / EB006-V9

User avatar
LeighM
Matrix Staff
Posts: 1932
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 464 times
Been thanked: 658 times
Contact:

Re: Problem LCD component

Postby LeighM » Mon May 19, 2014 11:23 am

Hi
Yes, sorry, we are a bit short staffed at the moment, holiday season :D
I’ve had another quick look and found that we have the same issue with a 16F1937 that does have the LAT instruction and is used by V6 LCD component (unlike 887)
I’ll see if I can get any further with the issue
Regards,
Leigh

User avatar
LeighM
Matrix Staff
Posts: 1932
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 464 times
Been thanked: 658 times
Contact:

Re: Problem LCD component

Postby LeighM » Mon May 19, 2014 1:14 pm

Hi

I've found the bug.
Please use the attached file for now (drop it into your ..\CAL\PIC folder)
(Still needs further work as a previous bug fix caused this issue, so I need to now fix the other bug :wink:

Leigh
Attachments
PIC_CAL_IO.h
(8.31 KiB) Downloaded 77 times
These users thanked the author LeighM for the post (total 2):
Crenwick (Mon May 19, 2014 1:58 pm) • medelec35 (Mon May 19, 2014 4:38 pm)
Rating: 10.53%
 

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Problem LCD component

Postby Crenwick » Mon May 19, 2014 1:58 pm

Hi Leigh,

That's perfect ! Works now fine :)
Bernard

Flowcode 6 / EB006-V9

User avatar
LeighM
Matrix Staff
Posts: 1932
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 464 times
Been thanked: 658 times
Contact:

Re: Problem LCD component

Postby LeighM » Mon May 19, 2014 2:29 pm

Very good :)
Attached is the latest, now with both fixes :)
Attachments
PIC_CAL_IO.h
(8.38 KiB) Downloaded 60 times
These users thanked the author LeighM for the post:
medelec35 (Mon May 19, 2014 4:38 pm)
Rating: 5.26%
 

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Problem LCD component

Postby Crenwick » Mon May 19, 2014 3:05 pm

Done !

Problem solved.

Just a question, what was the other problem/fix ?
Bernard

Flowcode 6 / EB006-V9

User avatar
LeighM
Matrix Staff
Posts: 1932
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 464 times
Been thanked: 658 times
Contact:

Re: Problem LCD component (Solved)

Postby LeighM » Mon May 19, 2014 3:33 pm

There was a problem with the expansion of the following Flowcode statement, it would not work on target (due to compiler optimisation).

Code: Select all

$PORTB = NOT $PORTB