Results 1 to 3 of 3
Thread: Sioc Leading Zero Blanking Probs
-
04-28-2013, 01:46 AM #1
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Sioc Leading Zero Blanking Probs
Hi Guys,
Having a problem with blanking a leading zero on a O/C Display II card. I've tried to follow Nico Howto which was very helpful.
I have a four digit display for RPM and when below 1000rpm I want the leading zero supressed. I have run my code thru the IOconsole
in SIOC and it seems to give me the correct values UNTILL I hit > 1000 or 2000 rpm. It then goes weird giving incorrect values.
When operated with the hardware, Master card outputs and other Displays operate even though they are not configured in Sioc.
Could someone please review my code and see where im wrong and correct if possible. My maths and programming skills are
very basic and all help would be appreciated.
Here is the code and thanks
Les
Code:Var 6020, name rpm, Link FSUIPC_IN, Offset $0898, Length 2, Type 1 { L0 = &rpm * 10800 L1 = L0 / 65536 L2 = MOD L1 10 &Digitr = L2 L2 = MOD L1 100 &Digitl1 = L2 L2 = MOD L1 1000 &Digitl2 = L2 L2 = Div L1 1000 IF L2 < 1 { &Digitl3 = -999999 } ELSE { &Digitl3 = L2 } } Var 1, name Digitr Link IOCARD_DISPLAY, Digit 0, Numbers 1 Var 2, name Digitl1 Link IOCARD_DISPLAY, Digit 1, Numbers 1 Var 3, name digitl2 Link IOCARD_DISPLAY, Digit 2, Numbers 1 Var 4, name Digitl3 Link IOCARD_DISPLAY, Digit 3, Numbers 1
-
04-28-2013, 04:00 AM #2
Re: Sioc Leading Zero Blanking Probs
Hi Les,
It looks to me that the second and third digits are also wrong.
You forgot to divide by 10 before doing the Modulo operations. You have to divide by 10 in order to get the next digit.
Try this:
Code:Var 6020, name rpm, Link FSUIPC_IN, Offset $0898, Length 2, Type 1 { L0 = &rpm * 10800 L1 = L0 / 65536 L2 = MOD L1 10 &Digitr = L2 L1 = DIV L1 10 L2 = MOD L1 10 &Digitl1 = L2 L1 = DIV L1 10 L2 = MOD L1 10 &Digitl2 = L2 L1 = DIV L1 10 L2 = MOD L1 10 IF L2 = 0 { &Digitl3 = -999999 } ELSE { &Digitl3 = L2 } }
Nico
-
04-28-2013, 06:38 AM #3
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Re: Sioc Leading Zero Blanking Probs
Hi Nico,
Thanks, it works fine now in sioc sim, i thought i could do div with the Mod, but obviously i was wrong. Didnt think
to do div first.
Regards
Les