Hi all. I've just built a little 16f876a based surface mount board with a MAX233 convertor. The idea is that I'm going to load it up with a bootloader so I don't have to lug my programmer with me while I'm on vacation next week (yes, I work during my vacations). I wrote up the following little program to test that the RS232 connection is working. I've never used a bootloader before, so I just wanted to verify my hardware first. However, it isn't working. I've checked my circuit, and I think I'm ok. I scope the TX line on my PIC and get no activity. The program turns on port pins as it goes so I can see the progress, and it seems to get caught in the loop waiting for PIR1, TXIF to go high (porta,2 never gets set). So...I think I've done something funky in software. The main guts of this program used to work on a non A 16f876. Maybe that's the key? I thought I had changed the relevant bits. Maybe I should be looking for the TXSTA, TRMT bit instead of the TXIF bit? Maybe I've done something stupid and forgotten a bank switch? Here is my code...I'd appreciate it if someone could have a look. I know it isn't the best practice. It's in absolute mode, and it doesn't use interrupts. Bank switching is messy. The main goal is just to sit there spewing out data though. Here it is: LIST R=DEC ; list P=PIC16F876a #include p16F876a.inc __CONFIG (_HS_OSC & _WDT_OFF & _CP_OFF & _LVP_OFF & _PWRTE_ON & _BODEN_OFF ) ; #### - Updated Start_Vector EQU H'00' Interrupt_Vector EQU H'04' Ram_Base EQU H'20' Common_Ram_Base EQU H'70' Osc_Freq EQU D'16000000' CBLOCK Ram_Base temp endc ; ; ----------- ; DESCRIPTION ; ----------- ; ; Baud Rate = 9600, No Parity, 8 bits & 1 Stop Bit ; ; ------------- ; PROGRAM START ; ------------- ; org Start_Vector goto Start org Interrupt_Vector goto ISR_Start ISR_Start retfie Start bcf status, rp0 bcf status, rp1 clrf PORTA ; Clear the ports clrf PORTB clrf PORTC bsf status, rp0 ; Bank 1 movlw b'01000110' ; Setup ADC, All digital movwf ADCON1^ 0x080 movlw b'01011111' ; PortB pullups on movwf OPTION_REG^ 0x080 movlw b'00000000' ; Setup port directions movwf TRISA^ 0x080 movlw b'00000000' movwf TRISB^ 0x080 movlw b'11000000' ; set RC6 & RC7 as input movwf TRISC^ 0x080 bcf status, rp0 ; Bank 0 ; Setup UART bsf status, rp0 ; Bank 1 ; Baud Values with BRGH = 1 ; ((16000000/9600)/16)-1 = 103 movlw d'103' ; 9600 baud @ 16 Mhz Fosc +0.16 err movwf SPBRG^ 0x080 movlw b'00100100' ; brgh = 1 movwf TXSTA^ 0x080 ; enable Async Transmission, set brgh bcf status, rp0 ; Bank 0 ; ------------------------------------ ; PROVIDE A SETTLING TIME FOR START UP ; ------------------------------------ ; clrf temp Settle decfsz temp,f goto Settle goto Main Main bsf porta, 0 movlw b'10101010' movwf PORTB movlw b'00001010' movwf portc movlw 'T' call TXLoop movlw 'E' call TXLoop movlw 'S' call TXLoop movlw 'T' call TXLoop movlw ' ' call TXLoop goto Main TxLoop nop bsf porta, 1 movwf TXREG nop nop btfss PIR1,TXIF ;xmit buffer empty? goto TxLoop ;no, wait bsf porta, 2 return end Thanks for reading this far! Josh -- A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist