How to print received number on UART terminal

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
kumar123
Posts: 68
Joined: 17 Oct 2023 07:32

How to print received number on UART terminal

#1 Post by kumar123 » 22 Jan 2024 07:55

Hi,
I am using pic18f67k40 microcontroller. MCU clock frequency 64Mhz.
I want to print entered number on UART terminal, It can be any number(only positive number: 0,1,20,4560,123124,123143235435, ..... any ).The entered number can be print any number of times. Whenever I want to change printing number from new entered number, It should print that(new entered number) any number of time.

Regards,
Kumar

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: How to print received number on UART terminal

#2 Post by IvanJeremic » 22 Jan 2024 15:52

Hi,

As I understand you, you want a UART echo.

There are examples of Uart echo in the MikroC compiler.
uart_echo.png
uart_echo.png (18.03 KiB) Viewed 418 times
Regards,

Ivan.

stickwimp
Posts: 1
Joined: 23 Jan 2024 16:54

Re: How to print received number on UART terminal

#3 Post by stickwimp » 23 Jan 2024 16:57

Thank you the problem has been resolved. :)

kumar123
Posts: 68
Joined: 17 Oct 2023 07:32

Re: How to print received number on UART terminal

#4 Post by kumar123 » 25 Jan 2024 05:06

Hi Stickwimp,
Did you use same approach that I have mentioned :
I am using pic18f67k40 microcontroller. MCU clock frequency 64Mhz.
I want to print entered number on UART terminal, It can be any number(only positive number: 0,1,20,4560,123124,123143235435, ..... any ).The entered number can be print any number of times. Whenever I want to change printing number from new entered number, It should print that(new entered number) any number of time.
It works for this below code:
I will read any number and print, it works fine.
Code:1

Code: Select all

While(1){ 
         if(UART1_Data_Ready()== 1){
             UART1_Read_Text(input, ";", 255);
             UART1_Write_Text(input);
         }
}
but it does not work for this below code:
Code:2

Code: Select all

While(1){ 
         if(UART1_Data_Ready()== 1){
             UART1_Read_Text(input, ";", 255);
             UART1_Write_Text(input);
         }
         else {
             UART1_Write_Text(input);
         }
}
In code :2 If I entered any number(like:12, 10,234235, ......) first time it get stuck, in second time if I entered it print duplicate of that entered number(1212,1010,234235234235).

Regards,
Kumar

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: How to print received number on UART terminal

#5 Post by IvanJeremic » 25 Jan 2024 12:03

Hi,

I answered in the forum in the link below:
viewtopic.php?f=88&t=80482&p=318143#p318143

Regards,

Ivan.

dylandaviss123@gmail.com
Posts: 1
Joined: 22 Feb 2024 09:27

Re: How to print received number on UART terminal

#6 Post by dylandaviss123@gmail.com » 22 Feb 2024 09:28

IvanJeremic wrote:
25 Jan 2024 12:03
Hi,

I answered in the forum in the link below:
viewtopic.php?f=88&t=80482&p=318143#p318143

Regards,

Ivan burrito craft
It work for me.

kumar123
Posts: 68
Joined: 17 Oct 2023 07:32

Re: How to print received number on UART terminal

#7 Post by kumar123 » 26 Feb 2024 05:54

Hi dylandaviss123@gmail.com,

Could you share some snap shot or code, so that I can get some Idea. how to introduce external interrupt in code.
I am newbie in interrupt.

Regards,
kumar

rudolffw
Posts: 10
Joined: 13 Feb 2017 01:42

Re: How to print received number on UART terminal

#8 Post by rudolffw » 15 Mar 2024 18:03

phpBB [video]

https://youtu.be/5J5qZBHZi2g

Could be something like this video that your project.

RW

kumar123
Posts: 68
Joined: 17 Oct 2023 07:32

Re: How to print received number on UART terminal

#9 Post by kumar123 » 18 Mar 2024 08:28

Hi rudolffw,
Not like this.
you can refer this link for better understanding-viewtopic.php?f=88&t=80482&p=318143#p318143

Regards,
Kumar

Post Reply

Return to “mikroC PRO for PIC General”