Software UART reception failure

Status
Not open for further replies.

helmi_mjd

Member level 2
Joined
Feb 20, 2011
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Visit site
Activity points
1,668
Hi guys...
I have one problem regarding the software UART. It can transfers a character from Micro-controller but when i try to send from PC (through bluetooth), the micro-controller does not received it. This indicated by LED. Can anyone help me solving this problem? Here i attached the code.
PIC: 18F4520, Programmer: MPLAB IDE, Compiler: Hi-Tech C PIC18 (PRO)
 

Attachments

  • Software UART_PIC18F4520.txt
    5.2 KB · Views: 57

You are not using interruption to handle reception, and polling is not a good approach.
Take a look here to inspire at some implementations :




+++
 

You are not using interruption to handle reception, and polling is not a good approach.
Take a look here to inspire at some implementations :




+++

Thanks andre_teprom for fast reply. I will follow your suggestion and will let you know the after i make changes. Thanks again.
 

Hi andre, i already edit my code using reception interrupt but i still can't get the result. Could you please check my interrupt routine/any other part of my code is incorrect? Attached is the code. I used pin change interrupt for reception at RB7.
 

Attachments

  • Software UART_PIC18F4520_edited.txt
    6.3 KB · Views: 65

helmi_mjd,


Taking a quick overview, I noticed the following issues :
  • You inserted a delay into reception routine, which is not recomended;
  • You used interrupt based on pin-change, not properly based on uart reception itself;

Once I admit did not performed a more accurate analysis, and pehaps could happen other problems, I sugest you try compile other working examples, and just after, extract fragments to your code.


+++
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…