Hello Guys,
I have built a circuit in which an output is switched on at the press of a button. The on/off rate of this out put is settable. At the same time i have a counter display the count every time the output comes on. I use a TMR0 for this. At lower output rates the count is accurate, at higher rates the count displayed on the 3 digit 7 Segment display goes crazy.
i have read every thread in these forums on this case , but am still unable to fix this problem. i have also tried different clock speeds and prescaler rates to no avail.
Any help to fix this is much appreciated.
Thanks,
PIC-ER
LED DISPLAY REFRESH AND TMR0
Moderator: Benj
LED DISPLAY REFRESH AND TMR0
- Attachments
-
- 7seg4-display refresh.fcf
- (61.49 KiB) Downloaded 315 times
Last edited by PIC-ER on Fri Jan 25, 2013 11:00 pm, edited 1 time in total.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ANYONE ??LED DISPLAY REFRESH AND TMR0
Hello,
I think you need to call the clear seg macro before you call another show digit macro. So you need to do something like this.
showseg0
clearseg0
showseg1
clearseg1
showseg2
As part of the main Flowcode examples download there should be some good examples of how to drive the 7-seg displays using a timer interrupt.
I think you need to call the clear seg macro before you call another show digit macro. So you need to do something like this.
showseg0
clearseg0
showseg1
clearseg1
showseg2
As part of the main Flowcode examples download there should be some good examples of how to drive the 7-seg displays using a timer interrupt.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: ANYONE ??LED DISPLAY REFRESH AND TMR0
Hi Benj,
Thanks for the reply . Had already tried that, even put in a dwell between each one.
All credit to Medelec he caught it. I had a MOD in the interrupt macro.
Thanks to all,
Regards,
PIC-ER
Thanks for the reply . Had already tried that, even put in a dwell between each one.
All credit to Medelec he caught it. I had a MOD in the interrupt macro.
Thanks to all,
Regards,
PIC-ER
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: ANYONE ??LED DISPLAY REFRESH AND TMR0
Best to treat MOD as you would with delays.
If you have MOD in any of you macros including Main:
If MOD is then placed within an interrupt macro, corruption will occur.
It might be best to avoid MOD in interrupt macros altogether (even if not using MOD anywhere else)
Martin
If you have MOD in any of you macros including Main:
If MOD is then placed within an interrupt macro, corruption will occur.
It might be best to avoid MOD in interrupt macros altogether (even if not using MOD anywhere else)
Martin
Martin