Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] UART write problem when 0D is same as Carrage return.

Status
Not open for further replies.

rajib.das

Member level 3
Joined
Oct 23, 2013
Messages
54
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
415
Hi

I am trying to write a long variable in Mikro C pro, say 991245
its splitting in to four char (from LSB to HSB) as 0D 20 0F 00 in Hex.
problem is instead of writing 0D its printing new line. Because of carriage return setup on UART_Write(13) .

How to stop this or change the carriage return value 13 to something else.
 

Is there anyone can answer my question?
My problem was
MikroC UART write. How to send a decimal 13 without printing newline?
 

To send a long (4-byte) variable to UART first convert it to a HEX string then send out the result string. To do this use the LongWordToHex library function (for example).
See the help:
Miscellaneous Libraries > Conversions Library > LongWordToHex
 

Try this.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
unsigned int myInt = 13;
char myStr[23];
 
void main() {
 
 
        while(1) {
 
                  IntToStr(myInt, myStr);
                  UART1_Write_Text(LTrim(myStr));
                  Delay_ms(1000);
        }
}

 

Hello
Your program in the controller can send date like 0x0d, 0x0a ... It's the programme on your PC for example who need to interprete the data as a data, not as a command.
For this yoou can use escape character. The data can also be a command must be preceded by a special character. And if the data is to be transmitted this character, and well it should be also preceded by the escape character.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top