In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Rsadeika wrote: A common ground between them, hmmm. Does that mean another wire that connects at the ground connector on each board, no. When I do this stuff nothing turns out to be a simple matter. I have a direct cut and paste of the two programs. I am hoping it's some obvious that I overlooked. Thanks Ray *******CODE The slave ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- led1 var rc.0 led2 var rc.1 ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- rDATA var byte temp1 var byte ' ========================================================================= PROGRAM Start ' ========================================================================= ' ------------------------------------------------------------------------- ' Subroutine Declarations ' ------------------------------------------------------------------------- ledon1 sub ledon2 sub ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- Start: PLP_A = %00000000 PLP_B = %00000000 PLP_C = %00000000 main: do serin rc.7, N9600, rDATA loop until rDATA = "A" ledon1 ledon2 goto main end 'subs ledon1: low led1 pause 1000 high led1 return ledon2: low led2 pause 1000 high led2 return 'data ************************** The master ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX52,OSC4MHZ 'IRC_CAL IRC_4MHZ FREQ 4_000_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- IRpin VAR RE.0 ' IR input LED1 VAR RD.0 ' LED ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- ChUp con 16 'GoFore ChDn con 17 'GoBack Power con 21 'Power (red Button) ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- cmdCode VAR Byte ' IR command code (7 bits) cmdWork VAR Byte ' work space for cmd byte bitCount VAR Byte ' track bits received bitWidth VAR Byte ' measure bit width flags VAR Byte rxCmd VAR flags.0 ' receiving command rxBit VAR flags.1 ' measuring bit width? hasCmd VAR flags.2 ' command code available temp1 VAR Byte ' subroutine work vars temp2 VAR Byte temp3 VAR Byte temp var Byte rDATA var Byte ' ------------------------------------------------------------------------- INTERRUPT NOPRESERVE ' ------------------------------------------------------------------------- ISR_Start: ASM JB hasCmd, ISR_Exit ' exit if holding command JB rxCmd, Check_Bit ' receiving now? JB IRpin, ISR_Exit ' exit if IR line idle Start_Packet: SETB rxCmd ' set rx flags SETB rxBit CLR cmdWork ' clear work vars CLR bitWidth CLR bitCount JMP ISR_Exit Check_Bit: JNB IRpin, Update_BitWidth ' still in bit? JNB rxBit, ISR_Exit ' in idle period? CLRB rxBit ' no, clear bit flag CJA bitCount, #0, Test_DBit ' start or data bit? Test_SBit: CJA bitWidth, #74, Next_Bit ' proper start bit? CLR rxCmd ' no, reset JMP ISR_Exit Test_DBit: CLC RR cmdWork ' prep for next bit CJB bitWidth, #34, Next_Bit ' "1" bit? SETB cmdWork.6 ' yes, set it Next_Bit: CLR bitWidth ' clear for next bit INC bitCount ' update count CJB bitCount, #8, ISR_Exit ' done? SETB hasCmd ' set available flag MOV cmdCode, cmdWork ' copy work to output CLRB rxCmd ' clear rx flag JMP ISR_Exit Update_BitWidth: INC bitWidth ' else inc width SETB rxBit ' refresh in bit flag ENDASM ISR_Exit: RETURNINT 104 ' 26 uS @ 4 MHz ' ========================================================================= PROGRAM Start ' ========================================================================= ' ------------------------------------------------------------------------- ' Subroutine Declarations ' ------------------------------------------------------------------------- processCode sub gofore sub goback sub robotStop sub ledon sub ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- Start: PLP_A = %00000000 ' pull-up unused pins PLP_B = %00000000 PLP_C = %00000000 PLP_D = %00000000 PLP_E = %00000000 OPTION = $88 ' interrupt, no prescaler Main: IF hasCmd = 0 THEN Main ' wait for new code processCode ' put new code on LEDs hasCmd = 0 ' clear flag GOTO Main end ' ------------------------------------------------------------------------- ' Subroutine Code ' ------------------------------------------------------------------------- processCode: if cmdCode = ChUp then gofore endif if cmdCode = ChDn then goback endif if cmdCode = Power then robotStop endif '******************* rDATA = "A" temp = 255 tx_again: serout re.7, N9600, rDATA djnz temp, tx_again '********************* return gofore: ledon return goback: ledon return robotStop: ledon return ledon: low LED1 pause 1000 high LED1 return ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=103038#m103142 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)