Use of Uart_PutArray()

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

cross mob
Anonymous
Not applicable

I'm a beginner using PSOC 3 to complete a project for my masters. I've been trying to use to the Uart_PutArray function to transmit an Array to the PC using Uart.

   

here's some code I've used to simulate an application segment

   

#include <project.h>
#include <stdio.h>
#include <stdlib.h>

   


uint8 count[256];
uint8 channel;
int i,x,j;

   

int main()
{
    CyGlobalIntEnable; /* Enable global interrupts. */
    init();
   
   
    for(j=0;J<10000;j++)
    {
       channel=rand()%255;
       //UART_1_PutChar(channel);
       x=count[channel]+1;
    
       if(x>=0&&x<255)
       {
       
        //x=count[channel]+1;
        count[channel]++;
        //UART_1_PutChar(x);
        //UART_1_PutChar(0x0A);
        //CyDelay(200);
      
         }
       else
        break;
    }

   

        UART_1_PutArray(const uint8 count[],uint8 256);

   

}

   

    void init()
     {
        UART_1_Start();
        for(i=0;i<=255;i++)
        {
            count=0;
         }
        
       }
/* [] END OF FILE */

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum!

   

... and what does not work as you expect? Keep in mind that serial interface of a PC is at +-12V which might destroy your PSoC which has got a TTL level of 5V(as max), so you will need a level-shifter as MAX232. When you are using a CY8CKIT-030 there already is a level shifter on it, you just have to enable it and jumper Tx and Rx. Alternatively you an use an USBUART component, use the second USB-port of the board and using an emulated com-port on the PC side.

   

Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

View solution in original post

0 Likes
15 Replies