psoc 5 serial connect scilab

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

cross mob
feme_285141
Level 4
Level 4

 Tengo un problema con psoc 5 que conecta el puerto serie USB al scilab Agenda

   
     aquí está el scilab código:   
   
        
   
    
      CLF; // Borra la pantalla    
    
      n = 7000; // Número de muestras    
    
      y = queridos (1, n-1); // Vector acerca de dónde se almacenan los datos adquiridos    
    
      h openserial = (2, "9600, n, 8,1 '); // Abre el puerto serie    
    
      i = 1; // Declara un contador    
    
      x = [0: 1: n]; // Vector para el trazado de datos    
    
      mientras i <= n // ciclo para la adquisición de datos    
    
          olla = ascii (readserial (h)); // Almacena los datos recogidos en la variable olla    
    
             pot (i) // asigna elemento 1 pot el i-ésimo elemento del vector y    
    
              XPAUSE (800); // Hace una pausa de 800 microsegundos    
    
              i = i + 1; // Incrementar el contador    
    
        final // fin termina la adquisición    
    
          
    
      closeserial (h) // cierra el puerto serie    
   
0 Likes
5 Replies
feme_285141
Level 4
Level 4

 I have a Problem With psoc 5 That Connects the USB serial port scilab Agenda

   
    Here is the scilab code:   
   
        
   
    
     clf;                                               //limpia la pantalla    
    
     n=7000;                                      //numero de muestreos    
    
     y=ones(1,n-1);                            //vector de unos donde se almacenaran los datos adquiridos    
    
     h=openserial(2,"9600,n,8,1");    //abre el puerto serial    
    
     i=1;                                             //declara un contador    
    
     x=[0:1:n];                                    //vector para realizar la graficación de los datos                         
    
     while i<=n                                   //ciclo para la adquisición de los datos    
    
         pot=ascii(readserial(h));           //guarda el dato obtenido en la variable pot    
    
            pot(i)                       //asigna el elemento 1 de pot al i-esimo elemento del vector y    
    
             xpause(800);                       //realiza una pausa de 800 microsegundos    
    
             i=i+1;                                  //incrementa el contador    
    
     end                                             //termina la adquisición    
    
          
    
     closeserial(h)                              //cierra el puerto serial    
    
          
   
0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I assume the code you are showing is on the scilab side of the design ?

   

 

   

Common problems serial links (PSOC is Host) -

   

 

   

1) Baud rate clock not set to correct baud in PSOC

   

2) Interface from PSOC is TTL, you have to have level shifter/translator like

   

MAX232 to interface to another RS232 device, like a PC, connected to

   

PSOC.

   

3) Global interrupts not enabled in PSOC.

   

4) Client side settings should include no flow control.

   

5) Null modem cable interconnect between host and client, eg. Rx to Tx, Tx to Rx

   

between host and client.

   

 

   

Set up a test where Host is Txing and look at signal lines with a scope to see if you

   

are getting ~ signal levels referenced to ground -

   

 

   

The RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels for the data transmission and the control signal lines. Valid signals are either in the range of +3 to +15 volts or the range −3 to −15 volts with respect to the ground/common pin; consequently, the range between −3 to +3 volts is not a valid RS-232 level.

   

 

   

Regards, Dana.

0 Likes
feme_285141
Level 4
Level 4

if you send data but in string format but I want to vector

0 Likes
Anonymous
Not applicable

Is it possible to make a serial communication of matlab and PSoC 5LP????If Yes how??

0 Likes
feme_285141
Level 4
Level 4

YES. I use scilab resembles Malab, only a Prgrm open sorce.
Communication to the library for serial communications (UART) can suction.

0 Likes