In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote: I did some research on interrupts and was not able to get it working. It actually does not show anything on the displays now :( [code] DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 ID "M-SEG" 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 INTERRUPT ISR_Start: b1 = rpm 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 ISR_Exit: RETURNINT PROGRAM Start Start: TRIS_disp = %00000000 Main: PULSIN RPM_signal, 0, pWidth0 PULSIN RPM_signal, 1, pWidth1 pWidth0 = pWidth0 + pWidth1 pWidth0 = pWidth0 * 2 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 'display = PUT_DIGIT rpm GOTO Main SegMap: [/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#m277853 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)