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.

Serial communication with proteus

Status
Not open for further replies.

dmta

Member level 2
Member level 2
Joined
Mar 25, 2013
Messages
52
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Earth
Visit site
Activity points
1,650
Hi all,

I am trying to do serial communication using proteus and trying to write a value continously to the hyper terminal but I'm getting some wierd symbols. What am I doing wrong ? BTW BEGINNER

Regards

HTML:
void main(){

     unsigned int analog;

     TRISA.F0 = 1;
     Usart_Init(9600);

     while(1){

          delay_ms(500);
          analog = Adc_Read(0);
          Usart_Write(analog);

     }

}
 

Usart_Write() functions writes ascii characters like '0'. You analog variable is an interger variable. Convert it to string using IntToStr() function and then use USART_Write_Text(stranalog); I think you are using mikroC PRO 8051. Right?
 

Hi and thank you for your reply !!!!!!!

I did the follwoing changes but still not getting what I want. BTW I am using mikroC for pic

Code:
void main(){

     unsigned int analog;
     char txt[10];

     TRISA.F0 = 1;

     Usart_Init(9600);

     while(1){

          delay_ms(500);
          analog = Adc_Read(0);
          IntToStr(analog, txt);
          Usart_Write(txt);

     }

}
 

USART_Write() is to send individual Characters. Use UART_Write_Text(txt); If you are using UART1 then you should use UART1_Init(9600); and UART1_Write_Text(txt); Is there UART_Write(), UART_Write_Text(), and UART_Init() functions in mikroC PRO PIC? I think it is UARTx.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top