Continue to Site

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.

  • 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.

Am I USING PIC UART CORRECTLY??

Status
Not open for further replies.
oh and nigel i read through your rs232 tutorial, thanks, it helped a lot, however about all that timing stuff... is that relavent if i am using the in-built pic's uart? i take it that timing & delays etc are used if you are doing the transmission manually in software?
 
cyprio7 said:
oh and nigel i read through your rs232 tutorial, thanks, it helped a lot, however about all that timing stuff... is that relavent if i am using the in-built pic's uart? i take it that timing & delays etc are used if you are doing the transmission manually in software?

You are correct, if you use the USART, you don't need all that - check the last tutorial that one uses the USART.
 
cyprio7 said:
Ok, i will start using it. Is this easier to read?

It's a start, it's simply good practice to not use SMS style text on a forum. And will help you break a bad habit (wouldn't be acceptable at school, work etc...)

Avoid using RF till you get the hang of RS232, you'll only make the project harder to troubleshoot.

The PIClist project I posted earlier works as does Nigels example. Build them as is and try them out. Your PCs RS232 is pretty robust and can handle +/-15V on the I/O pins no problem. The MAX232 is limited to about 20ma and can do no damage to the port.
 
Hi guys. Thanks so much for all your help. Good news and bad news. Good news is that I have now got the basic communication working (at 4am in the morning which resulted me dancing around the room and clicking my fingers like a loony) lol.

I have written a program which sends the word "hello" from the pic to hyperterminal when the PIC first starts up, then, waits for a user to make rb6 high, so that it can then transmit the word "santa" ONCE, then, continue to wait in the loop and test rb6 to go high so it can transmit the word santa again.

When I make a connection to hyperterminal and start up the PIC, the word "hello" is displayed on hyperterminal, but then, the word "santa" keeps being transmitted over and over again so it looks something like this

hello
santasantasantasantasantasantasantasantasantasantasantasantasantasantasantasantasantasantasantasantasantasanta............. and so on

I have checked my code but I cannot find the problem. I checked to make sure that rb6 wasnt continuously being held high but it isnt, i also tried using rb4 as the user input button but the same problem occurs.

I also get some strange messages when I compile the code, such as

"processor superseded by command line. Verify processor symbol"
"processor-header file mismatch. verify selected processor"


could you please have a quick look at my code incase i am missing something, I have attatched it as a text file.

Thanks again for your help
 

Attachments

  • hypterm submit.txt
    2.6 KB · Views: 127
I've figured out the problem!! By accident! I've constructed this circuit on breadboard by the way. In my code, when rb6 (or 4 cant remember) goes high due to user input, the message is transmitted.

Because the message is transmitted so fast, once it has finished, the user is still actually holding down the button, although it only feels like you've only done one "click" of the button which seems to us as a fraction of a second.

I noticed this because I had a wire coming out from rb6, and i noticed whenever i touched it with my fingers, it would display

santasantasantasantasantasantasantasantasantasantasantasanta

due to the pin going high, im guessing the electricity from my own body?? Is this possible? This actually was happening though, when I let go, i noticed it stopped. Maybe it could have been some built up charge in the breadboard or something?? Who knows..


To over come this, i inserted a delay routine into my code, so that when the user presses a button, the message is sent, then a delay is called, to give the user a chance to "let go of" the button, or else the message will be written again.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top