CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

CCS and Errata - EUSART transmit mode

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
guy



Joined: 21 Oct 2005
Posts: 297

View user's profile Send private message Visit poster's website

CCS and Errata - EUSART transmit mode
PostPosted: Thu Jul 28, 2016 3:07 pm     Reply with quote

If anyone has the practice of reading the errata, this should be familiar:
Quote:
Under certain conditions, a byte written to the TXREG can be transmitted twice.

This appears in many chips (at the moment I am considering PIC16F1519).
It doesn't sound much fun Confused BUT according to the errata there is a workaround, to check the TXIF bit before writing to TXREG.
Does printf() and putc() work that way, or does CCS track the errata?
I am working with v. 5.048 BTW.

Slightly off topic, I'd rather use the amazing PIC16F18877 but MPLAB 8.92 doesn't support it. Is there a workaround for that (besides MPLAB-X) ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jul 28, 2016 5:26 pm     Reply with quote

In the MPLAB vs. 8.92 Project Build Options menu, put the .LST file format
in Symbolic mode. Then compile a test program and look at the list file.
It will show you if your version of the compiler polls TXIF before writing to
TXREG. The current version, 5.061, does this.

Test program:
Code:
#include <16F1519.h>
#fuses INTRC_IO,NOWDT
#use delay(clock=4M)
#use rs232(baud=9600, UART1, errors)

//=========================================   
void main(void)
{
putc(0x55);     
 
while(TRUE);
}
 
guy



Joined: 21 Oct 2005
Posts: 297

View user's profile Send private message Visit poster's website

PostPosted: Thu Jul 28, 2016 11:36 pm     Reply with quote

Thanks PCM programmer. I see a
Quote:
001E: GOTO @PUTCHARI_BIU_1

and although the label doesn't appear elsewhere in the LST, I do see
Quote:

.................... #use rs232(baud=9600, UART1, errors)
0003: BTFSS PIR1.TXIF
0004: GOTO 003
0005: MOVLB 03
0006: MOVWF TXREG
0007: MOVLP 00
0008: MOVLB 00
0009: GOTO 01F (RETURN)

so this looks covered.

A weird new thing for me is that the compiler converts all pins to digital by default:
Quote:
0017: CLRF ANSELA
0018: CLRF ANSELB
0019: CLRF ANSELC
001A: CLRF ANSELD
001B: CLRF ANSELE

Has it always been this way???
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Fri Jul 29, 2016 1:17 am     Reply with quote

Not always, but for a very long time.

Most older chips default to digital anyway.
You'll find quite a few posts from a few years ago, with people having trouble on chips where the pins default to analog.
At some point (probably about five years ago), CCS started making sure that on chips where this did apply, the default was digital at the start of their code.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group