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.

adc not getting output on hyperterminal

Status
Not open for further replies.

kishan s m

Newbie level 5
Joined
Mar 31, 2011
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,351
#include<pic.h>
void serial()
{
SPBRG=25;
SYNC=0;
BRGH=1;
SPEN=1;
TXEN=1;
}
int ADCvalue = 0;
void main(void)
{
serial();
TRISA =0x0FF;
TRISD=0x00;
TRISE=0x00;
ADCON0 = 0x05;
ADCON1 = 0x0CE;
while(1)
{
PORTA=0X01;
PORTD=0X00;
PORTE=0X03;
ADON=1;
GODONE=1;
while(GODONE!=0);
ADCvalue = (ADRESH*256) + ADRESL;
if(ADCvalue >= 204)
{ TXREG = '1';
while(TXIF==0);
}
else
{
TXREG = '1';
while(TXIF==0);
TXREG = 'L';
while(TXIF==0);
}
if(ADCvalue >= 409)
{
TXREG = '2';
while(TXIF==0);
}
else
{
TXREG = '2';
while(TXIF==0);
TXREG = 'L';
while(TXIF==0);
}
if(ADCvalue >= 614)
{
TXREG = '3';

while(TXIF==0);
}
else
{ TXREG = '3';
while(TXIF==0);
TXREG = 'L';
while(TXIF==0);
}
if(ADCvalue >= 819)
{
TXREG = '4';
while(TXIF==0);
}
else
{
TXREG = '4';
while(TXIF==0);
TXREG = 'L';
while(TXIF==0);
}
if(ADCvalue >= 1023)
{ TXREG = '5';
while(TXIF==0);
}
else
{
TXREG = '5';
while(TXIF==0);
TXREG = 'L';
while(TXIF==0);
}
ADON=0;
}
}
 

i want to display my output on hyperterminal,but i am getting nothing..:(
 

I dont see you clearing out TXIF after it has been set. Obviously it should show atleast one character on hyperterminal, but I think clearing it after it has been set would be good way to see expected results.

And are you sure you have the correct baud rate setting in both hyperterminal and in the PIC code?
 

hey,i am using real pic simulator.
i am when loading this program,i am getting buad rate=5000;instead of 9600..
now,please tell me where is the mistake in my program?????
 

what do you mean by you are getting a baud rate of 5000 instead of 9600 when loading the program????
 

Check the data sheet for baud rate calculation. There will be some standard values of SPBGR for BRGH =1(high baud rate mode).
There just confirm the baud and also the crystal you are using...

---------- Post added at 12:42 ---------- Previous post was at 12:37 ----------

Test if your ADC is working by just giving some led blinking function instead of TXREG=' '...if it is working then check baud rate selection table in data sheet and confirm every thing is ok...Still not working then check if your serial port interfacing is correct....Also check the continuity of serial port connecting wire...
 

hey,now i am getting output on hyperterminal..
but now i want to display from 0 to 1023...
so,can anyone help me....
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top