Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 18th September 2007, 11:53 AM   (permalink)
Default URGENT!! 16F877 & USART & Interrupt & Recieve Problem

Hello..
Im trying to make a connection between PC and PIC as you get from the topic..
In Hyperterminal; my pic can send a char. There is no problem. But when receiving any data, my pic doesnt break his silence. And this frustrates me..
As i search on net (and go into my electronic knowledge), i find that i should make common ground (pin 5). But when i try this; my pic doesnt send any char. (and nor recieves any data / char)When i leave this pin (5) float, it can send char. (dont say my pic is a little ... you get it)(and it cant receive). I think maybe i have problems in software. But it works well in Proteus / ISIS.
Any idea will be great help..
Sincerely..


P.S. my code:

#include <htc.h>
#include <delay.c>




void hatasil(void){
unsigned char zed;
if (OERR) {
TXEN=0;
TXEN=1;
CREN=0;
CREN=1;
}
if (FERR) {
zed=RCREG;
TXEN=0;


}
}

char verial(void) {
hatasil();
return RCREG;
}



void interrupt kesme(void){
if(RCIF) {
unsigned char yak;
RB5=0;
DelayMs(250);
DelayMs(250);
DelayMs(250);
DelayMs(250);
RB5=1;
yak=verial();
//yak++;
RCIF=0;
DelayMs(50);
TXREG=yak;
}
}

main(void){
unsigned char alik;
OPTION=0xFF;
INTCON=0b11000000;
PIE1=0b00100000;


TRISC=254;


SPBRG=129;
BRGH=1; ı
SYNC=0;
TX9=0;
RX9=0;
SPEN=1;
RCIE=1;
CREN=1;
TXEN=0;
TXEN=1;



RCIF=0;


TRISB=0;
PORTB=0;


alik='b';
RB5=1;
while(!TXIF)
{
TXEN=0;
TXEN=1;

}
TXREG=alik;
while(1)
{

}
}

P.S. 2
im using MAX 232 equivalent HIN232..


maybe it helps;
im measuring 0 Volts on Pic's Receieve pin..
ive changed ihn232 with another but it stands like this.
im using 5 1uF caps..
ive tried both shorted RTS CTS - DTR DSR pins and not shorted.. only 2 pins connected ( RD TD )
it didnt help..
im using hyperterminal in handshaking none mode..
im thinking of a problem in software but it works in proteus..
maybe hardware
aarghh.. ive not much time.
(a circuit schematic will be nice but my draws are a mess..)
__________________
i dont feel alright: \\
DaMieN is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
16F877 communication problem! liupengjian Micro Controllers 3 5th July 2004 10:47 AM
Interrupt on GP Change problem Dan East Micro Controllers 2 22nd May 2004 06:12 PM
A very strange problem on 16F877 liupengjian Micro Controllers 5 21st April 2004 10:36 AM
Interrupt problem huanyong Micro Controllers 1 1st November 2003 02:26 AM
External Interrupt not working - 16F877 usaf1 Micro Controllers 0 15th September 2003 01:17 AM



All times are GMT. The time now is 08:57 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker