|
|
View previous topic :: View next topic |
Author |
Message |
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
16F18325 - UART and I2C pins |
Posted: Fri Apr 13, 2018 1:11 am |
|
|
Hi all,
I have a existing 16F1825 project board. and would like to change to chip 16F18325.
I have the uart connected to PIN_C4(Tx) and PIN_C5(Rx) and I2C connected pins PIN_C0(SCL) and PIN_C1(SDA).
Below is the code i am trying. The I2C works but uart does not. If anybody can help, thanks. I want to use hardware uart and i2c.
Code: |
#include <16F18325.h>
#device ADC=8
#FUSES MCLR
#FUSES PUT
#FUSES NOFCMEN
#FUSES NOCKS
#FUSES BROWNOUT
#FUSES BORV27
#FUSES NOPROTECT
#FUSES NOCPD
#FUSES NOLVP
#FUSES RSTOSC_HFINTRC
#FUSES NOWDT
#define RTC_SDA PIN_C1
#define RTC_SCL PIN_C0
#define RS232_RX PIN_C5
#define RS232_TX PIN_C4
#pin_select U1RX=RS232_RX
#pin_select U1TX=RS232_TX
#pin_select SCL2OUT=RTC_SCL
#pin_select SCL2IN=RTC_SCL
#pin_select SDA2OUT=RTC_SDA
#pin_select SDA2IN=RTC_SDA
#use rs232(STREAM=r232,baud=9600, xmit=RS232_TX,rcv=RS232_RX)
#use i2c(master,Fast,sda=RTC_SDA, scl=RTC_SCL, FORCE_HW)
void main()
{
while(1)
{
printf("Hello');
delay_ms(3000);
}
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 13, 2018 3:26 am |
|
|
What is your CCS compiler version ? |
|
|
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
|
Posted: Fri Apr 13, 2018 3:38 am |
|
|
Compiler version: 5.078 |
|
|
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
|
Posted: Fri Apr 13, 2018 4:02 am |
|
|
Thanks PCM programmer.
This post below from Ttelmah helped to make it work.
https://www.ccsinfo.com/forum/viewtopic.php?t=55295&highlight=16f18325
for others who would like to run both uart and i2c see below:
Code: |
#fuses MCLR, NOCLKOUT, PUT, BROWNOUT
#fuses LPBOR, BORV27, NOLVP
#fuses NOEXTOSC, RSTOSC_HFINTRC, NOWDT
#fuses NOPPS1WAY
#define RTC_SDA PIN_C1
#define RTC_SCL PIN_C0
#define RS232_RX PIN_C5
#define RS232_TX PIN_C4
#use delay(internal=8M)
#pin_select U1RX=RS232_RX
#pin_select U1TX=RS232_TX
#pin_select SCL1OUT=RTC_SCL
#pin_select SCL1IN=RTC_SCL
#pin_select SDA1OUT=RTC_SDA
#pin_select SDA1IN=RTC_SDA
#use rs232(UART1,baud=9600, bits=8, stop=1, parity=N )
#use i2c(Master, fast, sda=RTC_SDA, scl=RTC_SCL, force_hw) |
Regards,
Jai. |
|
|
|
|
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
|