Jonathan, I have been toying with the USART of the 16c73a, with some limited success. I'm new to this stuff so I don't know how much help I can be, but some code fuctions and initialisation blocks are below, regardless. Just a couple of points/questions first. Why do you not initialise the data direction of your output pins? Is this not required on you chip, or are trying to limit your posted code? You do not need to be clearing TXREG after each byte sent. Once a new value is loaded into the TXREG, it is transferred to the TSR register one instruction later (provided of course the last value in the TSR has been completely sent - otherwise, it sits there until TSR is empty). You do not need to disable the transmitter in between bytes (for normal operation - you may have something else going on). Only after a new value is loaded into TXREG is it tranferred to the TSR register, so as long as you are not putting new values in TXREG, nothing should transmit. Why do you include NOPs in your loop. I ask this one for myself. I have found that looping simply on TRMT or TXIF (PIR1) does not work for some reason (I have added a call to a simple delay myself). Is this your own code hack, or did you receive a heads up on this from some literature or perhaps somebody else? I am collecting all the information I have on the USART so that I can make a post on the PICLIST at some point, but it is still incomplete - I hope this snip of info is helpful for now. ; Initialise PORTC (USART) BCF STATUS, RP0 ; Bank 0 (PORTC) CLRF PORTC ; Clear output data latches BSF STATUS, RP0 ; Bank 1 (TRISC) MOVLW b'11000000' ; MOVWF TRISC ; Set RC<5:0> as outputs ; RC<7:6> as inputs, but really USART TX/RX ; (as per 16cxx specification sheet page 99) ; Initialise the UART BCF STATUS, RP0 ; Bank 0 (RCSTA) MOVLW 0x90 ; SPEN=1, CREN=1 MOVWF RCSTA ; BSF STATUS, RP0 ; Bank 1 (SPBRG & TXSTA) MOVLW 0x09 ; BRG Control Value MOVWF SPBRG ; BSF TXSTA, TXEN ; Enable transmission (default is Async) ; Program code here ... ; Function requires value to be transmitted to be loaded into W BEFORE this ; function is called (be carefull not to over write value in TRANS_DELAY) UART_TRANS BSF STATUS, RP0 ; Bank 0 (PIR1 & TXREG) LOOP call TRANS_DELAY BTFSS PIR1, TXIF ; TXIF=1 ? (= TXREG clear) GOTO LOOP ; NOP ; MOVWF TXREG ; Transmit value loaded into W before ; this function was called RETURN If your chip does not required page/bank bits, ignore the 'Bank 0/1' statements - if it does, be sure you are selecting the correct page/bank. Actually, this whole post assumes that USARTs are structurally the same between chips (a decent assumption, but I'm not positive). It may be worth finding out if it is so. Let me know how it goes. Regards, Mario Jonathan ferguson wrote: > > Can some one Show me how to output, through the USART on a PIC17c43, say 2 > or 3 bytes of data one after another. I can now output one byte but I can't > get it to output more that one here's the code I've been playing with but > all this does is crash my PC > > ############################################################## > LIST P=PIC17C43 > #INCLUDE > > ORG 0 > > MOVLW 0X4 ;INIT > MOVWF SPBRG > BCF TXSTA , SYNC > BSF RCSTA , SPEN > > MOVLW 0X43 ;NEW DATA > MOVWF TXREG ;MOVE TO TXREG > BSF TXSTA , TXEN ;SEND > LOOP NOP > NOP > NOP > NOP > NOP > NOP > NOP > NOP > BTFSS TXSTA , TRMT ;POLL TRMT TO SEE WHEN TSR IS > EMPTY > GOTO LOOP > CLRF TXREG , F ;NOT SURE IF THIS NEEDED > BCF TXSTA , TXEN ;DISABLE SEND > MOVLW 0X43 ;NEW DATA > MOVWF TXREG ;IN TXREG > BSF TXSTA , TXEN ;SEND > > GOTO $ > > END > > ###################################################################### > > Thanks in advance > > Regards > > Jonathan Ferguson > ------------------------------------------------------ > Research Student > Microelectronics/Radiation Group > University of Lancaster > Lancaster > Bailrigg > Lancs LA1 4YR > Tel : (01524) 593326 > Fax :(01524) 381707 > j.ferguson@lancaster.ac.uk > ICQ 31455174 > > ----- Original Message ----- > From: Andy Kunz > To: > Sent: Friday, September 03, 1999 2:04 PM > Subject: [OT] Blatant Advertisement > > > This is blatant off-topic advertising, but just so you can see what I do > in > > my "spare" time. > > > > Not totally OT, though - it has a PIC in it (driving the speed > > control/electronic throttle). > > > > http://www.rc-hydros.com/videos.html > > > > Andy > > > > ================================================================== > > Andy Kunz Life is what we do to prepare for Eternity > > ------------------------------------------------------------------ > > andy@rc-hydros.com http://www.rc-hydros.com - Race Boats > > andy@montanadesign.com http://www.montanadesign.com - Electronics > > ================================================================== > >