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

PIC18F2525 BRG16 / SPBRG UART PROBLEM

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



Joined: 05 Mar 2008
Posts: 1

View user's profile Send private message

PIC18F2525 BRG16 / SPBRG UART PROBLEM
PostPosted: Wed Mar 05, 2008 8:06 am     Reply with quote

Hello,

I made a modbus slave that works correctly at 9600 baud with a 10MHz
crystal. When using a 20MHz crystal arise problems, it works with some
equipments, like a PC, but not with a modbus master built with a
PIC18F4620 (at 20MHz).

I thought it was a problem of baud generator, so, after trying with and
without BRGH1OK switch, I tried to set it by myself, using this parameters
SYNC=0; BRG16=1; SPBRG=520 (SPBRGH=2; SPBRG=8). The values
were calculated using the free program downloaded from micromagic systems.

The map register for PIC18F2525 I used is:
#byte SPBRGH = 0xFB0 // USART baud rate generator high byte
#byte SPBRG = 0xFAF // USART baud rate generator low byte
#bit BRG16 = 0xFAA.3 // 16bit baud rate enable bit (1-16bit, 0-8bit)
#bit SYNC = 0xFAC.4 // USART Mode Select bit (1-sync, 0-async)

Once assigned the values, on the compiler/IDE peripheral window all
the values are set to 0, but appears some register as SPBRG2 that
should be relate to a second UART that shouldn't exist on a PIC18F2525.
What was wrong? It seems as the compiler ignores the registers.

Every help will be appreciated,
thanks in advance
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