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

RS232 hardware configuration // PIC18f452 // picc PCB 4.110

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



Joined: 17 Nov 2012
Posts: 23

View user's profile Send private message

RS232 hardware configuration // PIC18f452 // picc PCB 4.110
PostPosted: Fri Sep 13, 2013 12:56 am     Reply with quote

Hello,
I configured my pic as PLL active with 10MHz witch make it run at 40MHz
but when I tested the communication it don't work as it should be.
I think that the baud was not well configured.
This is my configuration for the rs232 hardware module:

Code:

   RCSTA = 0x90;
   TXSTA = 0x22;
   SPBRG = 64; // 9600 with 10Mhz & x4 PLL
   TXREG = 0; // dummy write
   RCIE=1;
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri Sep 13, 2013 1:48 am     Reply with quote

Just use #use RS232.
Directly setting register is not really the way that CCS is designed to work.
louwi_138



Joined: 17 Nov 2012
Posts: 23

View user's profile Send private message

PostPosted: Fri Sep 13, 2013 4:19 am     Reply with quote

Ttelmah wrote:
Just use #use RS232.
Directly setting register is not really the way that CCS is designed to work.


I know that but it wil not activate the hardware module cause it's a software solution since I can shoose what ever pins I want for the rs232 communication !
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri Sep 13, 2013 4:37 am     Reply with quote

You misunderstand #use RS232.....

_If_ you select the hardware pins, it sets up the hardware port. It _only_ switches to being a 'software solution', if you use pins where there is no hardware.

#use RS232, programs the UART.

Even better, if you use the UART name it selects the UART automatically. So:

#USE RS232(UART1, Baud=9600, parity=N, ERRORS)

sets up UART1 ready for use.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri Sep 13, 2013 6:30 am     Reply with quote

BTW: unless you like spending extra $$ on antique pics
have you considered the 4520 ??
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri Sep 13, 2013 8:33 am     Reply with quote

Agreed. A good point. Many of the 'old' PIC's have been superceded by models that use less power, cost less, and have improved features. The 452, is a classic example of such an 'older' chip.

Best Wishes
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