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

Soft- or Hardware UART, where can I see this

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



Joined: 03 Mar 2005
Posts: 6

View user's profile Send private message

Soft- or Hardware UART, where can I see this
PostPosted: Thu Mar 10, 2005 4:23 am     Reply with quote

Hello,

I want to use the hardware Uart on my PIC (16F877).

But I think the compiler use a Soft uart?? Is there any way to see what the compiler implement? The Hard or Soft uart.

Thanks for help.
Paolino



Joined: 19 Jan 2004
Posts: 42

View user's profile Send private message

PostPosted: Thu Mar 10, 2005 5:54 am     Reply with quote

Well, if you setup:
Code:
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)

you tell the compiler to use the built-in UART, because pins C6 and C7 are internally connected to the hardware UART. If you specify different pins, you use software UART.

Refer to the datasheet: it is the first source of information!

Paolo.
RoProe



Joined: 03 Mar 2005
Posts: 6

View user's profile Send private message

PostPosted: Thu Mar 10, 2005 6:10 am     Reply with quote

Hi,

thats right. but if I use the Hardware Pins and Speed that is not supported by the hardware, it also use the Softuart.
Paolino



Joined: 19 Jan 2004
Posts: 42

View user's profile Send private message

PostPosted: Thu Mar 10, 2005 6:39 am     Reply with quote

If baud rate is not compatible with the osc frequency, the compiler generate an error and does not compile (the error is BAUD RATE IS OUT OF RANGE) and you can not use neither the hardware UART nor the software one.

Paolo.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 10, 2005 10:11 am     Reply with quote

Quote:
Is there any way to see what the compiler implement ?
The Hard or Soft uart.

Yes. Look at the .LST file generated by the compiler. If the compiler
is using the hardware USART, when it transmits a character it will test
bit 0x0C.4 in a loop and then move the character into register 0x19.
(This is the TXREG in the 16F877). If you see a short block of code
like this, you're using the hardware USART:
Code:

0000                00306 .................... putc(0x55); 
0014 3055       00307 MOVLW  55
0015 1E0C       00308 BTFSS  0C.4
0016 2815       00309 GOTO   015
0017 0099       00310 MOVWF  19
0000                00311 ....................   


If the compiler is using a software USART, you will not see any writes
to register 0x19. The program will typically jump to a low address in
ROM with a large block of code (35 or more lines) that starts like this:
Code:

0004 1683       00285 BSF    03.5
0005 1306       00286 BCF    06.6
0006 1283       00287 BCF    03.5
0007 1306       00288 BCF    06.6
0008 3008       00289 MOVLW  08
0009 00F8       00290 MOVWF  78
000A 0000       00291 NOP
// continues for approximately 30 more lines
RoProe



Joined: 03 Mar 2005
Posts: 6

View user's profile Send private message

PostPosted: Thu Mar 10, 2005 10:14 am     Reply with quote

Thank you for your help. Now i can see what is Software and Hardware uart.
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