In SX Microcontrollers, SX/B Compiler and SX-Key Tool, ackeric wrote: I may be trying to do something not possible or inadvisable. Simply I need to send out two byte of serial data , almost any speed will be fine , the faster the better. I need this to be done while watching a dozen IR transistors. The transistor pins or monitored In the ISR. That part works fine. As predicted the ISR screws up my serout Command, sometimes it work some times it does not. Can I simply disable the ISR during serout subroutine? Timing should not be a problem As the pulses on from the transistors last at least 200 ms, plenty of time to send out a few bytes. I have tried screwing around with the option reg. With No luck. Here Is my test code It just motors one transistor. [code]' ========================================================================= ' ' File...... SingleFlakeTest.SXB ' Purpose... SX/B Programming Template ' Author.... ' E-mail.... ' Started... ' Updated... ' ' ========================================================================= ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX48, OSCXT2 FREQ 50_000_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- SOutA PIN RB.0 OUTPUT PULLUP Mt1Front PIN RD.0 INPUT cmos Mt1Back PIN RD.1 INPUT cmos ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- AllFWD CON %11111111 AllRVS CON %00000000 BUAD CON "T19200" FwdMt1 CON $C6 MaxSpd CON $7F ZeroSpd CON $0 Front CON 1 Back CON 0 ACT CON 0 notact CON 1 LmRs CON 1800 WaitTime CON 3000 ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- i VAR Byte TempA VAR Byte TempB VAR Byte PosFlagFT VAR BIT PosFlagBK VAR BIT NextPos VAR BIT MtNum Var BYTE SPED VAr BYTE ' ------------------------------------------------------------------------- INTERRUPT 1000000 ' ------------------------------------------------------------------------- ISR_Start: Serout SoutA,buad, MtNum Serout SoutA,buad, SPED IF Mt1Front = ACT THEN PosFlagFT = ACT Else posFlagFT =NotAct ENDIF Watch PosFlagFT ISR_Exit: RETURNINT ' ========================================================================= PROGRAM Start ' ========================================================================= Pgm_ID: DATA "SX/B Template", 0 ' ------------------------------------------------------------------------- ' Subroutines / Jump Table ' ------------------------------------------------------------------------- GoFront SUB 0 GOBack SUB 0 Wait SUB 0 MotCom SUB 2 ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- Start: OPTION = $88 Serout SoutA,Buad, FwdMt1 Serout souta,buad, zeroSpd PAUSE 2000 Main: ' DO GoFront Wait 'GoBack 'Wait LOOP GOTO Main ' ------------------------------------------------------------------------- ' Subroutine Code ' ------------------------------------------------------------------------- SUB GoFront MotCom FwdMt1, MaxSpd PAUSE LmRs DO While PosFlagFt = NotAct IF PosFlagFt = ACT THEN MotCom FwdMt1, ZeroSpd ENDIF LOOP ENDSUB SUB GoBack MotCom FwdMt1, MaxSpd PAUSE LmRS DO While PosFlagbk = 0 If posFlagBK = act THEN MotCom FwdMt1, ZeroSpd ENDIF LOOP ENDSUB SUB Wait PAUSE WaitTime ENDSUB SUB MotCom 'Code to diable ISR TempA = __PARAM1 TempB = __PARAM2 SEROUT SOutA,Buad, TempA SEROUT SOutA,Buad, TempB 'Code to enable ISR ENDSUB [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=288173 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)