how could I implement PRINTF() in UART with a PSOC3

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I do not understand how to make printf() work with uart in psoc3 i put this code:

   

 

   

#include          
#include "stdio.h"     
     
    char putchar(char c)     
{     
     UART_WriteTxData((uint8)c);     
     return c;     
}     
     
int main()     
{     
     
    /* Place your initialization/startup code here (e.g. MyInst_Start()) */     
    UART_Start();     
    CyGlobalIntEnable; /* Uncomment this line to enable global interrupts. */     
    for(;;)     
    {     
        printf("Hello");     
        CyDelay(500);     
           
    }     
}    

   

 

   

but in the hyperterminal does not show de message correctly, instead "HELLO" it shows "HLOEL" so it did send the caracters but doesn't sended FIFO

0 Likes
1 Reply
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

The Tx command is non blocking, I suspect printf() does not

   

check its write status either, so you might try a status of Tx

   

before you return from the TxWrite ?

   

 

   

0 Likes