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 support@ccsinfo.com

Set_UART_Speed() How does this work ?

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








Set_UART_Speed() How does this work ?
PostPosted: Sat Jul 31, 2004 6:33 am     Reply with quote

At what time does the PCH V3.206 compiler set the BAUDCON register ? I can't find it in the LST file .

#include <18F6621.h>
#use delay(clock=14745600)

.................... Set_UART_Speed(1200);
0CBC: MOVLW BF
0CBE: MOVWF FAF
0CC0: MOVLW 22
0CC2: MOVWF FAC
.................... Set_UART_Speed(2400);
0CC4: MOVLW 5F
0CC6: MOVWF FAF
0CC8: MOVLW 22
0CCA: MOVWF FAC
.................... Set_UART_Speed(4800);
0CCC: MOVLW 2F
0CCE: MOVWF FAF
0CD0: MOVLW 22
0CD2: MOVWF FAC
.................... Set_UART_Speed(9600);
0CD4: MOVLW 17
0CD6: MOVWF FAF
0CD8: MOVLW 22
0CDA: MOVWF FAC
.................... Set_UART_Speed(19200);
Ttelmah
Guest







Re: Set_UART_Speed() How does this work ?
PostPosted: Sat Jul 31, 2004 6:55 am     Reply with quote

Anonymous wrote:
At what time does the PCH V3.206 compiler set the BAUDCON register ? I can't find it in the LST file .

#include <18F6621.h>
#use delay(clock=14745600)

.................... Set_UART_Speed(1200);
0CBC: MOVLW BF
0CBE: MOVWF FAF
0CC0: MOVLW 22
0CC2: MOVWF FAC
.................... Set_UART_Speed(2400);
0CC4: MOVLW 5F
0CC6: MOVWF FAF
0CC8: MOVLW 22
0CCA: MOVWF FAC
.................... Set_UART_Speed(4800);
0CCC: MOVLW 2F
0CCE: MOVWF FAF
0CD0: MOVLW 22
0CD2: MOVWF FAC
.................... Set_UART_Speed(9600);
0CD4: MOVLW 17
0CD6: MOVWF FAF
0CD8: MOVLW 22
0CDA: MOVWF FAC
.................... Set_UART_Speed(19200);

It doesn't.
The BAUDcon register, is setup as part of the UART initialisation. It is not changed for a different baud rate, so there is no access for the set_uart_speed function.

Best Wishes
Guest








Re: Set_UART_Speed() How does this work ?
PostPosted: Sat Jul 31, 2004 11:29 am     Reply with quote

Ttelmah wrote:
It doesn't.
The BAUDcon register, is setup as part of the UART initialisation. It is not changed for a different baud rate, so there is no access for the set_uart_speed function.

Best Wishes


That's kind of strange .... the BAUDCON has to be set somewhere....
BAUDCON1 is at address 0XF7E .
I can't find that address anywhere in the LST file.

Are you telling me it happens by magic ? :-)

or is there "stuff" that CCS hides ? I thought the LST included everything .
Eric Minbiole



Joined: 10 Jun 2004
Posts: 16
Location: USA

View user's profile Send private message Visit poster's website

PostPosted: Sat Jul 31, 2004 11:57 am     Reply with quote

Quote:
or is there "stuff" that CCS hides ? I thought the LST included everything .


Yes, by default, CCS hides the code for a lot of their 'library' functions. Take a look at the #list & #nolist directives. The CCS headers usually turn off listing at the top, and restore it at the bottom. You could remove the #nolist from the top of 18F6621.h, and you'll probably see the BAUDcon register access.
Guest








PostPosted: Sat Jul 31, 2004 12:14 pm     Reply with quote

Eric Minbiole wrote:
Quote:
or is there "stuff" that CCS hides ? I thought the LST included everything .


Yes, by default, CCS hides the code for a lot of their 'library' functions. Take a look at the #list & #nolist directives. The CCS headers usually turn off listing at the top, and restore it at the bottom. You could remove the #nolist from the top of 18F6621.h, and you'll probably see the BAUDcon register access.


Yes I got that... but there are no direct ref. to the BAUDCON1 or 2 reg.

Foo.... The Errata sheet mentions a problem with the UART and it would be great to know what is used and how it's setup.
Ttelmah
Guest







Re: Set_UART_Speed() How does this work ?
PostPosted: Sat Jul 31, 2004 2:37 pm     Reply with quote

Anonymous wrote:
Ttelmah wrote:
It doesn't.
The BAUDcon register, is setup as part of the UART initialisation. It is not changed for a different baud rate, so there is no access for the set_uart_speed function.

Best Wishes


That's kind of strange .... the BAUDCON has to be set somewhere....
BAUDCON1 is at address 0XF7E .
I can't find that address anywhere in the LST file.

Are you telling me it happens by magic ? :-)

or is there "stuff" that CCS hides ? I thought the LST included everything .

CCS hides a lot.
Turning off the 'nolist' directive, makes a lot more visible, but you will still see gaps in the code. The easiest thing, s to import it into a package with a disassembler (MPLAB for instance), and search in this. I have had to do this in the past for a couple of such register updates... :-(
It does make debugging a real 'pain' at times.

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