OK.....so to answer the couple of questions... why did I set and clear the TXEN bit? only because when I put the module together I was making sure on entry and exit it would be a known state, but once I had the calls and other structure put together, I could clean that up..which I did. So it appears the real culprit was the btfss vs btfsc Sometimes you can't see the forest for the trees :-) Christopher Head wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I think you want "btfss", not "btfsc". BTFSC means "test and skip if CLEAR", which means "SKIP IF TRMT=0", which means skip OUT of the loop if TRMT=0 => transmit register is NOT empty => transmit register is full => still sending. BTFSS means "test and skip if SET", which means "SKIP IF TRMT=1", which means skip OUT of the loop if TRMT=1 => transmit register IS empty => finished sending. I assume TRMT means the same on the 913 as it does on the 648A (I don't have a 913 datasheet to hand). If the polarity is inverted, then (1) ignore my message, and (2) your comment is backwards. Chris alan smith wrote: > So I really havent done much with 16F serial, and the 18F stuff I can get to work flawlessy (so far at least), so I am having a small issue with this code on the '913 > > > To preface, it works...almost. I have a string defined such as it uses a jump table to index into it, and has a null on the end to terminate. I can address into it, grab the character and it sends it out, so the USART is setup properly, and single stepping it displays each character, so far so good. > > Now, when I do it full speed....I lose characters. I'm thinking...ok....the buffer isnt clearing out by the time I go to get the next character and send it. Cheating....add delay. But doesnt fully explain things. > > So here is the code that sends the character, held in Wreg > > TX_CHARACTER > banksel TXSTA > bsf TXSTA,TXEN > banksel TXREG > movwf TXREG > _txCharLoop > call DEBOUNCE > btfsc TXSTA,TRMT ; check buffer, wait till empty (1=empty) > goto _txCharLoop > bcf TXSTA,TXEN > return > > > This code is the one that works yet drops characters. If I pull out the debounce call, it breaks. I was thinking that checking the TRMT bit should do the job without the delay but doesn't appear to. I was thinking banksel needs to be set prior to looking at the TRMT bit, but adding that breaks it. So I can break it...meaning that it might send the first character or just a '.' It has to be something obvious, but what I've play with doesnt seem to help. > > I am running a 4MHz xtal, with the BRG and SPRGH settings for 9600baud, 8/n (if that was wrong then i would imagine I wouldnt be getting out good data at all). > > Any thoughts? > > > --------------------------------- > Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: GnuPT 2.7.2 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHFDuKytrPjvMzl6YRAvXGAJ4wbUC/XSWGc15taBM6Zr13Z3AyPQCfVA8f yN/nXmG10dd2H07aqtv6QIM= =ESTX -----END PGP SIGNATURE----- -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --------------------------------- Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist