As well as the other comments
After the ' banksel TXREG' you will be in BANK0, TXSTA is in BANK1 so I
would change your call to DEBOUNCE for banksel TXSTA, I personally
always restore my calls to BANK0 so I would add a BANKSEL 0 (might be
wrong syntax, I use a macro) before returning
Good Luck
Dave
Jan-Erik Soderholm wrote:
{Quote hidden}> Any special reason to enable/disable the USART sender
> for each character ?
>
> Jan-Erik.
>
> 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.
>>