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.

URGENT!! 16F877 & USART & Interrupt & Recieve Problem

Status
Not open for further replies.

DaMieN

New Member
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..)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top