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.

Help in USART Terminal, MikroC and Proteus

Status
Not open for further replies.

Eng_Bandar

Junior Member level 3
Joined
Aug 7, 2010
Messages
31
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,472
Hello for all,

I want send data (letters or numbers) by USART Terminal tool in MikroC Pro

This is my code ( example from help file in MikroC Pro )


Code:
char uart_rd;

void main() {
  ANSEL  = 0;                     // Configure AN pins as digital
  ANSELH = 0;

  UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize

  UART1_Write_Text("Start");
  UART1_Write(10);
  UART1_Write(13);

  while (1) {                     // Endless loop
    if (UART1_Data_Ready()) {     // If data is received,
      uart_rd = UART1_Read();     // read the received data,
      UART1_Write(uart_rd);       // and send data via UART
    }
  }
}

and this is circuit

**broken link removed**

I have two problems

1- If I send 'a' I should recieve 'a' but I recieve other letter (I sent 'a' I recieved 'y' :| ) Why ?

this is picture illustrate that


**broken link removed**

2- In Proutes I don't see any thing in Virtual Terminal just black screen Why ?

**broken link removed**

help please
 

it will be clear to you if you lay out the start bit, ascii code for the letter you are trying to send, and the stop bit.

---------- Post added at 02:44 PM ---------- Previous post was at 02:43 PM ----------

I would also suggest that you watch the waveform on the RX and TX pins to help you understand the problem.
 

Hi millwood,
Thank you for reply

I am beginner. Can you explain '' lay out the start bit, ascii code for the letter you are trying to send, and the stop bit".

What is benefit if I see waveform?

thank you again
 

Yes, I am sure from baud rate.
 

reading a few good books on uart would be the best help you need at this point.
 

reading a few good books on uart would be the best help you need at this point.

If you don't want help people KEEP your philosophy for yourself.

Any help guys
 

that's the best help you can get, quite frankly.

unfortunately, you aren't intelligent enough to understand that.
 

Dear millwood,

I think you have strange policy in replying. You want all people in one level in knowledge ! . Anyone can says you should read more books about this, I want ask you about this sentence Do you think this is helping?! without mentioned any names of books that may be help me. I want to tell you this is not helping this is only reprimand.

I am here to learn and I am not expert. If you see yourself expert and don't want help me up to you but please don't give me bad messages.

Finally, I want remeber you IF you don't work you don't have problems.


---------- Post added at 07:41 AM ---------- Previous post was at 07:31 AM ----------

that's the best help you can get, quite frankly.

unfortunately, you aren't intelligent enough to understand that.

hahahaha

Your sentence can't changes the TRUTH if I intelligent or not.
I will find who want help others without bad messages.

If the speaking is silver, the silent is GOLD.
 

I would recommend you as millwood wrote on the first post to take a look with a scope (inside Proteus) at RX and TX raw signals. With that you can see exactly what you are sending and receiving. Good luck!
 

I would recommend you as millwood wrote on the first post to take a look with a scope (inside Proteus) at RX and TX raw signals. With that you can see exactly what you are sending and receiving. Good luck!

Hi Sink0
thank you for your reply

these pictures that you want


**broken link removed**

I send 'a' should recieve 'a' but in fact I recieve 'y' Why ?

I use USART Terminal Tool in MikroC Pro to send and recieve through RS232 in Proteus

Check this picture


**broken link removed**

finally, I use Virtual Serial Port Driver
COM1 for USART Terminal
COM2 for RS232 in Proteus


**broken link removed**

I hope problem clear now.
 
Last edited:

Sorry for my ignorance if i missed something but does it make any sense to you have a signal on TX line before the RX signal is over?
 

Sorry for my ignorance if i missed something but does it make any sense to you have a signal on TX line before the RX signal is over?

If I understood your answer, I can't sense it because it is very fast.
 

I think you have strange policy in replying.

I don't have a policy.

You want all people in one level in knowledge ! .

I think for YOUR benefit, you want to possess the requisite knowledge before venturing too far out. That's why we don't teach 3-yr old kids calculus.

Anyone can says you should read more books about this, I want ask you about this sentence Do you think this is helping?!

what I gave you the best advice you will get. but you apparently don't understand it.

without mentioned any names of books that may be help me.

I trusted that you were smart enough to figure out what books to read.

I want to tell you this is not helping this is only reprimand.

sorry if you think so.

I am here to learn and I am not expert.

just because you are here to learn a subject does not mean that subject should be taught to you. You lack a good understanding of the basics for the conversation to be helpful to you.

If you see yourself expert and don't want help me up to you but please don't give me bad messages.

I am no expert, and I really wanted to help you, that's why I gave you such an excellent advice. too bad it went wasted on you.
 

If I understood your answer, I can't sense it because it is very fast.

I cant say the reason yet, but unless you are using some kind of hardware loopback mode you cant send anything back to terminal if you dont know what you are sending. I dont use Proteus, but comparing both yellow and blue signals.. You should just have some kind of signal on blue (TX) after the stop bit of the yellow line (RX). Something should be wrong because UART1_Data_Ready() just should return 1 after the stop-bit. Thats clearly not happening because you are reading something from UART buffer and sending it at TX before receiving the all the 8 bits. How you are setting your oscillator at your code? Try sending different letters and see if you can find any pattern.
 

Can you STOP it ??!!

one of the problems posting on a public forum is that you don't have control over what others are to say.

so if you don't want others to opine on you, don't post to a public forum.
 

one of the problems posting on a public forum is that you don't have control over what others are to say.

so if you don't want others to opine on you, don't post to a public forum.

millwood

frankly, what you want ?

I don't need for your advices keep it for yourself. Can you out from my topic?.


Sorry but you want my reply like this.

I don't want waste my time with you.
 

mmm i checked the COMPIM from Proteus... in fact it puts the received data en RXD so it's ok to connect it directly to the RXP of the PIC and the Terminal...

I just made a small test... the COMPIM and the virtual terminal...
and i just realized that the COMPIM has 2 baud rates! so i just made sure, all was at 9600 (for my tests!)

don't forget to re-check this connections and add a level converter (max232) for a real connection..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top