Hi all,
I have a simple program which counts pulses on PORTB,0 (using the interrupt) and outputs the count to an LCD via a variable Count1. Count1 is set as type ULONG. However, when the count reaches 32768 it rolls over to -32768 and counts downwards. In the C code the definition is MX_GLOBAL MX_UINT32 FCV_COUNT1 = (0x0);
Code attached,
Thanks,
Dave
Problem with ULONG variable?
Moderator: Benj
-
- Flowcode v5 User
- Posts: 104
- Joined: Fri Oct 10, 2014 11:15 am
- Has thanked: 27 times
- Been thanked: 22 times
- Contact:
-
- 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: Problem with ULONG variable?
Hi Dave.
Instead of using LCD PrintNumber
Use LCD PrintFormattedNumber.
You will also need to enter 1 in the Format for unsigned Number.
You may also require a small delay within main loop.
Martin.
Instead of using LCD PrintNumber
Use LCD PrintFormattedNumber.
You will also need to enter 1 in the Format for unsigned Number.
You may also require a small delay within main loop.
Martin.
Martin
-
- Flowcode v5 User
- Posts: 104
- Joined: Fri Oct 10, 2014 11:15 am
- Has thanked: 27 times
- Been thanked: 22 times
- Contact:
Re: Problem with ULONG variable?
Hi Martin,medelec35 wrote:Hi Dave.
Instead of using LCD PrintNumber
Use LCD PrintFormattedNumber.
You will also need to enter 1 in the Format for unsigned Number.
You may also require a small delay within main loop.
Martin.
All now working fine.Thanks once again for your invaluable help.
Dave.
-
- 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: Problem with ULONG variable?
Your welcome Dave.
Glad all is working as expected.
Thanks for letting us know.
Martin
Glad all is working as expected.
Thanks for letting us know.
Martin
Martin