I have been beating on this thing for a month now. I think I am doing what the manual says to do, but the receive side just won't work. My O'Scope tells me that pin 26 is high, pulsing low when I type a letter. Pin 25 does the same thing when a message goes out. When I run the program I get the "hi" message on the console, but the letters I type do not echo. If you can make any suggestions, I would REALLY appreciate it Thank you, Fred Thompson fthompso@mail.win.org LIST p=16c74 ;chip type INCLUDE P16C74.INC ;define program constants here ;define program Variables here TxOutPnt equ 0x28 TxBuffLen equ 0x29 ReceiveOff equ 0x2A Scratch equ 0x2D ISRfsr equ 0x32 ISRstatus equ 0x33 ISRw equ 0x34 ISRScratch equ 0x35 TxBuff equ 0x58 ;8 letter output buffer ReceiveBuf equ 0x78 ;8 letter input buffer ;Start Actual program org 0000 ;reset vector goto START ;goto begining of program org 0004 ;interrupt vector movwf ISRw ;Save registers movf STATUS,0 movwf ISRstatus movf FSR,0 movwf ISRfsr bcf STATUS,5 ;deselect bank 1 btfsc PIR1,4 ;Serial Transmit Interrupt ? goto TxInt ;if so goto serial Transmit Interrupt service btfsc PIR1,5 ;Serial Receive Interrupt ? goto RxInt ;if so goto serial Receive interrupt service goto ISRgoback ;no known interrupt return ;Fall through to Receive interrupt RxInt: movlw ReceiveBuf ;get address to store character addwf ReceiveOff,0 ;add offset to next vacent space movwf FSR ;store address to indirect register ;NOTE: IRP not used in P16C7x otherwise you would set it here movf RCREG,0 ;Fetch the received character movwf INDF ;Store received character in receive buffer incf ReceiveOff,1 ;increment the receive buffer pointer ;(this also informs the program that there is data present) movlw TxBuff ;Fill transmit buffer with message movwf FSR ;ECHO Received letter movf RCREG,0 ;get letter again movwf INDF ;put into buffer clrf TxOutPnt movlw 1 ;send 1 letter movwf TxBuffLen ;Then re-enable transmit interrupt bsf STATUS,5 ;select bank 1 bsf PIE1,4 ;{1} ;set interrupt enable bcf STATUS,5 ;select bank 0 goto ISRgoback ;done TxInt: ;Transmit buffer empty interrupt, send next letter movf TxBuffLen,1 ;test value of length btfss STATUS,2 ;skip if zero flag set goto SendChar ;bufLen hi so send next letter ;otherwise get rid of interrupt bsf STATUS,5 ;select bank 1 bcf PIE1,4 ;{1} ;clear interrupt enable bcf STATUS,5 ;select bank 0 goto ISRgoback ;done SendChar: movlw TxBuff ;get buffer address addwf TxOutPnt,0 ;offset to the next letter movwf FSR ;move to "read indirect" address register movf INDF,0 ;and read indirectly movwf TXREG ;then send the letter incf TxOutPnt,1 ;and increment the offset pointer movf TxOutPnt,0 ;then check to see if we are done with the strin g subwf TxBuffLen,0 ;by comparing with string length btfss STATUS,2 ;is zero is set we are done with string goto ISRgoback ;otherwise, we are done for now clrf TxOutPnt ;reset output pointer clrf TxBuffLen ;and length which tells program we are finished bsf STATUS,5 ;select bank 1 bcf PIE1,4 ;{1} ;clear interrupt enable bcf STATUS,5 ;select bank 0 goto ISRgoback ISRgoback: ;restore registers before returning movf ISRfsr,0 movwf FSR movf ISRstatus,0 movwf STATUS movf ISRw,0 retfie START: ;start main program ;OPTION_REG[81] = {5}=0, {3}=1(prescaler on) {3-0} = 7 slow prescaler ;INTCON[8B] = {5} = 1(timer interrupt enabled) Initialization: clrwdt ;clear Watch Dog Timer bsf STATUS,5 ;03,{5} ; select bank 1 movlw 0x0f ;set prescaler to slowest speed movwf OPTION_REG ;{1} ;for slow watch dog timer bcf STATUS,5 ;deselect bank 1 clrf PORTB ;06 bsf STATUS,5 ;03,{5} ; select bank 1 movlw 0x80 ;port b bit 7 input, remaining bits output movwf TRISB ;{1} ;set data direction register movlw 0xC0 ;port C all output except Rx and Tx movwf TRISC ;{1} ;assume STATUS,5 (bank 1) from above movwf TRISD ;{1} movlw 0x07 ;all 3 port E inputs movwf TRISE ;{1} movlw 0xFF ;all port A inputs movwf TRISA ;{1} bcf STATUS,5 ;deselect bank 1 bcf PORTB,1 ;Motors Off clrf PCLATH ;upper address part 0 clrf ReceiveOff ;Start Serial I/O port (Global interrupt turned on later) bsf STATUS,5 ;select bank 1 ; bsf TXSTA,2 ;{1} ;Set BRGH High baud rates movlw 0x24 ;0010,0100 movwf TXSTA movlw 0x40 ;set baud rate to 9600 (10Mhz Xtal) 64 decimal movwf SPBRG ;{1} ; bcf TXSTA,4 ;{1} ;clear SYNC asynchronous serial ; bcf TXSTA,6 ;{1} ;clear TX8/9 8 bit data bsf PIE1,4 ;{1} ;set TXIE transmit interrupt enable bsf PIE1,5 ;{1} ;set RCIE receiver interrupt enable ; bsf TXSTA,5 ;{1} ;set TXEN transmit enable bcf STATUS,5 ;deselect bank 1 movlw 0xB0 ;1011,0000 movwf RCSTA ; bsf RCSTA,4 ;set CREN receiver enable ; bcf RCSTA,6 ;clear RC8/9 8 bit data ; bsf RCSTA,7 ;set SPEN movf RCREG,0 ;clear input register just incase ;Start timer routine movlw TxBuff ;Fill transmit buffer with message movwf FSR movlw 'h' ;ascii h from hi movwf INDF ;put into buffer incf FSR,1 ;increment address pointer movlw 'i' ;ascii i from hi movwf INDF ;put into buffer incf FSR,1 ;increment address pointer movlw 0x0D ;return movwf INDF ;put into buffer incf FSR,1 ;increment address pointer movlw 0x0A ;line feed movwf INDF ;put into buffer incf FSR,1 ;increment address pointer clrf TxOutPnt movlw 4 ;send 4 letters movwf TxBuffLen ;Now turn on TXIE interrupt to send message (done later) ; Initialize analog processor movlw 0xC0 ;enable Global int. & serial int movwf INTCON Loop2: clrwdt ;clear Watch Dog Timer #ChipID: goto Loop2 ;NO loop #LastLine: END