Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussions

MATLAB UART and Nios II

Altera_Forum
Honored Contributor II
2,003 Views

Hello, 

 

Can anyone help me explain why if I perform  

 

fprintf(s, '%s','103') in Matlab, and for Nios II 

 

char heatOutput[128]; 

 

while( !( uart_status & ALTERA_AVALON_UART_STATUS_RRDY_MSK ) ) 

{ uart_status = IORD_ALTERA_AVALON_UART_STATUS(UART1_BASE); } 

 

if( (uart_status & ALTERA_AVALON_UART_STATUS_RRDY_MSK) != 0) 

printf("heatOutput: "); 

for(x=0;x<128;x++) 

while( !( uart_status & ALTERA_AVALON_UART_STATUS_RRDY_MSK ) ) 

{ uart_status = IORD_ALTERA_AVALON_UART_STATUS(UART1_BASE); } 

 

 

heatOutput[x] = IORD_ALTERA_AVALON_UART_RXDATA(UART1_BASE) ; // Read character 

printf("%c", heatOutput[x]); 

 

all I get from my printf is the last character in the send string:  

heatOutput: 33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 

 

(instead of heatOutput: 103) 

 

How ever long the string I sent from Matlab (or even with %c or %i), printf only shows the last character. 

 

Help please. 

 

Thank you.
0 Kudos
0 Replies
Reply