View previous topic :: View next topic |
Author |
Message |
guy
Joined: 21 Oct 2005 Posts: 297
|
CCS and Errata - EUSART transmit mode |
Posted: Thu Jul 28, 2016 3:07 pm |
|
|
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 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
|
|
Posted: Thu Jul 28, 2016 5:26 pm |
|
|
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
|
|
Posted: Thu Jul 28, 2016 11:36 pm |
|
|
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: 19520
|
|
Posted: Fri Jul 29, 2016 1:17 am |
|
|
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. |
|
|
|