In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote: Here is what i am attempting.... I am wanting to have a set of 7 segment displays to show my current RPM on my car. I am using an RPM function that i found on here and now I am trying to get it to show the RPM on the displays. Everything works except there is a VERY noticeable flicker on the displays. Can anyone help me on how to remove this flicker? [code] RPM_signal PIN RC.0 TRIS_disp VAR TRIS_B rpm VAR WORD pWidth0 VAR WORD pWidth1 VAR WORD dividendMSW VAR WORD dividendLSW VAR WORD overflow VAR BIT doneBit VAR BIT display VAR RB digit VAR WORD digit1 VAR WORD b1 VAR WORD PROGRAM Start PUT_DIGIT SUB 2 getrpm FUNC 3, 0 Start: TRIS_disp = %00000000 Main: rpm = getrpm display = PUT_DIGIT rpm GOTO Main PUT_DIGIT: b1 = __WPARAM12 LOW RA.1 digit1 = b1 / 10 digit = __REMAINDER READ SegMap + digit, display pause 5 HIGH RA.1 LOW RA.2 digit1 = digit1 / 10 digit = __REMAINDER READ SegMap + digit, display pause 5 HIGH RA.2 LOW RA.3 digit1 = digit1 / 10 digit = __REMAINDER READ SegMap + digit, display pause 5 HIGH RA.3 RETURN getrpm: PULSIN RPM_signal, 0, pWidth0 PULSIN RPM_signal, 1, pWidth1 pWidth0 = pWidth0 + pWidth1 dividendMSW = $005B dividendLSW = $8D80 rpm = 1 overflow = 0 DO doneBit = rpm.15 rpm = rpm << 1 IF overflow = 1 THEN rpm.0 = 1 dividendMSW = dividendMSW - pWidth0 ELSE IF dividendMSW >= pWidth0 THEN rpm.0 = 1 dividendMSW = dividendMSW - pWidth0 ENDIF ENDIF overflow = dividendMSW.15 dividendMSW = dividendMSW << 1 dividendMSW.0 = dividendLSW.15 dividendLSW = dividendLSW << 1 LOOP UNTIL doneBit = 1 rpm = rpm << 1 rpm.0 = overflow IF dividendMSW >= pWidth0 THEN rpm.0 = 1 ENDIF RETURN rpm ENDFUNC [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=277837 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)