# putcUSART

Status
Not open for further replies.

#### butters

##### Member
hi all...

from what i know putcUSART(0x66); is to send an "f" in terms of hexadecimal to Ascii...

now the thing is that how do i make send more than 1 byte at any point of time?

thanks!

putsUSART?

#### Russ Hensel

##### New Member
You cannot send more than one char. at a time. With a loop you can send one char right after another. Look for a 0b0 at then end of a string.

#### Wond3rboy

##### Member
hi all...

from what i know putcUSART(0x66); is to send an "f" in terms of hexadecimal to Ascii...

now the thing is that how do i make send more than 1 byte at any point of time?

thanks!
Use

putsUSART For data memory
putrsUSART For program memory

Also you can send a character in any format by using appropriate notations

0bxxxxxxxx for binary
0xXX for Hex
'x' for Ascii
xx for Decimal

Of course, remember that these values will be sent and not their ASCII equivalents.

You should go through
https://www.electro-tech-online.com/custompdfs/2009/08/MPLAB_C18_Libraries_51297f.pdf
You cannot send more than one char. at a time. With a loop you can send one char right after another. Look for a 0b0 at then end of a string.

No need to loop if one complete string is being sent.If continously then yes.

If you want an example code then i can post it for you.

Last edited:

#### fermat7

##### Member
use a loop with putcUARTx...

or putsUARTx

#### Wond3rboy

##### Member
use a loop with putcUARTx...

or putsUARTx

I dont see it in the library.

#### fermat7

##### Member
..what's the compiler are you using?

#### butters

##### Member
..what's the compiler are you using?

c18... well i tried to send 4 bytes by repeating the step 4 times...

#### kchriste

##### New Member
Forum Supporter
Did it work? If not, what happened?

#### Wond3rboy

##### Member
Code:
//No need to monitor flag for writing in USART all is automatic

#include<p18f1320.h>
#include<usart.h>
#pragma config OSC=INTIO2,WDT=OFF,LVP=OFF
void main(void)
{
TRISBbits.TRISB0=0;
OSCCON=0b01100000;// 4MHz crystal//
//while(!OSCCONbits.IOFS); since this causes problem in proteus
OpenUSART(USART_TX_INT_OFF &// 8 bit mode,4800 BR//
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_LOW,
12);// Change this for different BR//
while(1)
{
putrsUSART ("\n\rHello World!\n\r");
}
}

I did offer example code and here it is.Sorry for late reply. If you want help with any other function os C18 then i can help with them also.

To run the simulation just download a demo copy of proteus from labcenterelectronics.co.uk.Compile the code and add the Hex file by double clicking on the IC.

#### Attachments

• 18F1320SERIAL.zip
11.8 KB · Views: 109
Status
Not open for further replies.