I am trying to send an Array to a host app. a array type short. I obtain
easily if I will be of type int. I am using the CCS 3,1 and VB 6.0 our
EXCEL(VBA)
what I have that to change to send a short type? a sine wave for example!
**excel host app (VBA)**
Private Sub CommandButton1_Click()
Dim rtdx As Object
Dim row, col, rowx, colx, i, canais As Integer
Dim status As Double
Dim data As Long
Worksheets(1).Range("B5:IV16384").Clear
Set rtdx = CreateObject("RTDX")
status = rtdx.Open("ochan", "R")
row = 5
col = 2
rowx = 5
i = 0
Do
status = rtdx.ReadI4(data)
Select Case status
Case Is = SUCCESS
Worksheets(1).Cells(row, col) = data
row = row + 1
If (i = 6) Then
i = 0
rowx = rowx + 1
End If
colx = 4
colx = colx + i
Worksheets(1).Cells(rowx, colx) = data
i = i + 1
Case Is = FAIL
MsgBox ("Erro Lendo os Dados")
Exit Do
Case Is = ENoDataAvailable
MsgBox ("Dados N Disponiveis")
Exit Do
Case Is = EEndOfLogFile
MsgBox ("Todos os Dado Recebidos!")
Case Else
MsgBox ("Erro")
Exit Do
End Select
Loop Until status = EEndOfLogFile
status = rtdx.Close()
End Sub
****Target app C6000 - Works****
#define TAMANHO 100
#define Pi 3.141592654
RTDX_CreateOutputChannel(ochan);
static void Gerar_Buffer (double *dp);
void main (void)
{
double data[TAMANHO];
int i = 0;
TARGET_INITIALIZE();
RTDX_enableOutput(&ochan);
for ( i = 0; i < 1; i += 1)
{
Gerar_Buffer (data);
while (
!RTDX_write(&ochan, data, sizeof(data))
);
}
RTDX_disableOutput(&ochan);
printf("\n\nTeste Completo");
}
/* Gero do Array */
static void Gerar_Buffer ( double dp[] )
{
int i;
for (i = 0; i < TAMANHO; i++)
{
dp[i] = i;
}
}
Euclides Alexander de Castro Jr.
Eng. de Telecom - 8 Fase
mcb_blu@mcb_...
cel.: (47) 8804-1256