EmbeddedRelated.com
Forums

Problem with sending a string from uC to PC using FTDI

Started by c140986 November 5, 2010
Hello, 

I am using a FT232BL in order to connect a PIC18F2450 to a USB-PORT. 
The FTDI is using a 48MHZ and my serial port hat 9600 bis/s so I am using
the baudrate 51. 
In order to test the FTDI-Device I am trying to send a string to a terminal
(Hterm or Tera Term) but I just receive blanks "\n" :( 
Could you please help me to find the mistake in my code, thank you!!!  

#include <stdio.h> 
#include <usart.h>   
#include "p18f2450.h" 



#pragma config FCMEN   = ON	 //Fail-Safe Clock Monitor enabled 
#pragma config IESO    = OFF	//Oscillator Switchover mode disabled 
#pragma config PWRT    = OFF	//Power-up Timer disabled 
#pragma config MCLRE   = ON	 //MCLR pin enabled, RE3 input pin disabled  
#pragma config LPT1OSC = OFF	//Disabled, T1 operates in standard power mode

#pragma config PBADEN  = OFF	//PORTB<4:0> pins are configured as digital
I/O on Reset   
#pragma config STVREN  = ON	 //Stack full/underflow will cause Reset   
#pragma config LVP     = OFF    //Single-Supply ICSP disabled  
#pragma config WDT = OFF	 // NO WATCH DOG TIMER 

#define BAUD_RATE_GEN 51 

void main (void){ 
unsigned char Txdata[]= "HELLO"; 

OpenUSART(USART_TX_INT_ON & USART_RX_INT_ON & USART_ASYNCH_MODE &
USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, BAUD_RATE_GEN); 

while(1){ 
putsUSART((char *)Txdata);  
}//End while 

CloseUSART(); 

}//End void 




Best regards 


	   
					
---------------------------------------		
Posted through http://www.EmbeddedRelated.com
On 05/11/2010 20:06, c140986 wrote:
> Hello, > > I am using a FT232BL in order to connect a PIC18F2450 to a USB-PORT. > The FTDI is using a 48MHZ and my serial port hat 9600 bis/s so I am using > the baudrate 51. > In order to test the FTDI-Device I am trying to send a string to a terminal > (Hterm or Tera Term) but I just receive blanks "\n" :( > Could you please help me to find the mistake in my code, thank you!!! > > #include<stdio.h> > #include<usart.h> > #include "p18f2450.h" > > > > #pragma config FCMEN = ON //Fail-Safe Clock Monitor enabled > #pragma config IESO = OFF //Oscillator Switchover mode disabled > #pragma config PWRT = OFF //Power-up Timer disabled > #pragma config MCLRE = ON //MCLR pin enabled, RE3 input pin disabled > #pragma config LPT1OSC = OFF //Disabled, T1 operates in standard power mode > > #pragma config PBADEN = OFF //PORTB<4:0> pins are configured as digital > I/O on Reset > #pragma config STVREN = ON //Stack full/underflow will cause Reset > #pragma config LVP = OFF //Single-Supply ICSP disabled > #pragma config WDT = OFF // NO WATCH DOG TIMER > > #define BAUD_RATE_GEN 51 > > void main (void){ > unsigned char Txdata[]= "HELLO"; > > OpenUSART(USART_TX_INT_ON& USART_RX_INT_ON& USART_ASYNCH_MODE& > USART_EIGHT_BIT& USART_CONT_RX& USART_BRGH_LOW, BAUD_RATE_GEN); > > while(1){ > putsUSART((char *)Txdata);
try putsUSART(TxData) also what are you doing about the transmit & receive interrupts, assuming interrupts are getting enabled somewhere?
> }//End while > > CloseUSART(); > > }//End void > > > > > Best regards > > > > > --------------------------------------- > Posted through http://www.EmbeddedRelated.com