rudasi
Newbie level 1
- Joined
- Jun 26, 2014
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 6
Hello,
I am trying to get the UART TX to work but am unable to.
My initialisation code is,
My send data to the tx code is
I am using a logic analyzer on pin RA2 (my pps configured TX pin) but dont see anything. I am not sure where in my setup I am going wrong. Any help would be appreciated.
Rahul
I am trying to get the UART TX to work but am unable to.
My initialisation code is,
Code:
void configure_TX_port(){
PPSLOCK = 0x55;
PPSLOCK = 0xAA;
PPSLOCK = 0;
RA2PPS = 0x14;
PPSLOCK = 0x55;
PPSLOCK = 0xAA;
PPSLOCK = 1;
CREN = 1;
SYNC = 0;
SPEN = 1;
SPBRG = (int)(4000000L/(16UL * 9600) -1);
TXSTA = (0x4|0x20);
}
My send data to the tx code is
Code:
void putch(unsigned char byte) {
/* output one byte */
while (!TXIF) /* set when register is empty */
TXREG = byte;
}
I am using a logic analyzer on pin RA2 (my pps configured TX pin) but dont see anything. I am not sure where in my setup I am going wrong. Any help would be appreciated.
Rahul