thanks for reply pommie, hopefully you have a great day
yes i know i tried it like a thousend time.i have changed my codes .
now this is my new code; (its all code)
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = OFF // Brown-out Reset Enable bit (BOR disabled)
#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#define _XTAL_FREQ 16000000L
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <xc.h>
/**********************************************************************
HEADER FILE
***********************************************************************/
#include<pic.h>
/**********************************************************************
MAIN FUNCTION
***********************************************************************/
void main()
{
int a=63;
TRISC = 0x80; /* RC6(TX)-O/P, RC7(RX)-I/P */
SPBRG = 0x81; /* Serial Baud Rate Generator for 9600 */
TXSTA = 0X24; /* TXEN=1, SYNC=0, BRGH=1 */
RCSTA = 0X90; /* Reception Enable (SPEN=1,CREN=1) */
TXREG = 'A'; /* Load the character to be transmitted */
RCREG=a; /* Retransmit the received character */
TXREG=RCREG;
while(!TRMT); /* Wait here till transmission is complete */
while(1)
{
if(RCIF==1)
{
RCIF = 0; /* Clear Receive interrupt flag bit */
RCREG=a; /* Retransmit the received character */
while(!TRMT); /* Wait here till transmission is complete */
if (RCREG==69){ /* E in ascii */
TXREG=0X46; /* F in hex */
TXREG=a+10; /* I in hex */
}
}
}
}
/************************ END OF PROGRAM ********
those codes are working fine. i have change my codes cause of the i have changed my mind, i didnt want to receive or read any string, so now i told you guys im a newbie so i need read ascii like here;
for example; im want to read a string from pc which is like "Q45" and then i want to convert it to ascii codes[example:Q-->81 , 4-->52 , 5-->53 and i need to see on UART 815253 ]
but the problem is when i type it down i can only get "81" which is ascii code of "Q"...
ineed some help ,thanks in advance ...