• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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!
 

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
http://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:

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
	ADCON1=0x7F;
	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

Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top