this is my program:
for the declaration
"#include <p18cxxx.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <usart.h>
#include "C:\Users\Administrateur\Desktop\hid\HID\system\typedefs.h"
#include "C:\Users\Administrateur\Desktop\hid\HID\system\usb\usb.h"
#include "C:\Users\Administrateur\Desktop\hid\HID\io_cfg.h" // I/O pin mapping
#include "C:\Users\Administrateur\Desktop\hid\HID\user\user.h"
#include "C:\Users\Administrateur\Desktop\hid\HID\system\lcd\picstar_def.h" //pour affichage
#include "C:\Users\Administrateur\Desktop\hid\HID\system\lcd\picstar_delays.h" //pour l'affichage
#include "C:\Users\Administrateur\Desktop\hid\HID\system\lcd\xlcd_driver.h" // includes xlcd.h
#define ON 1
#define OFF 0
/** V A R I A B L E S ********************************************************/
#pragma udata
char Buffer[64];
char var[] ;"
and the process:
"
void ProcessIO(void)
{
int i;
int j;
int nb;
int lnvar ;
u8 counter=0 ;
u8 LCD_buffer[16];
pr:
init_lcd();
LCD_BACKLIGHT=ON;
while(1)
{ i=0;
j=0;
USBTasks();
if (HIDRxReport(Buffer,PacketSize ) > 0) // USB receive buffer has data
{
lcd_gotoxy(0,1);
fprintf(_H_USER," ");
strcpy(var,Buffer);
Buffer[0]=NULL;
switch (var[1])
{
case 'i':
PORTB=0x00;
break;
case 'a':
PORTB=0x80;
break;
case 'r':
PORTB=0x40;
break;
case 'l':
PORTB=0x20;
break;
}// fin switch
bn :
for(i=0 ; i<=lnvar ; i++)
{ lcd_gotoxy(0,0);
fprintf(_H_USER,"%d %s",lnvar,var);
lcd_gotoxy(16-i,1);
fprintf(_H_USER,"%s",var);
delay_ms(30);
if(i==lnvar)
{
i==0;
lcd_gotoxy(0,1);
fprintf(_H_USER," ");
// goto pr;
if (HIDRxReport(Buffer,PacketSize ) > 0)
goto pr;
else
goto bn;}
}
}
// goto boucle; }
}//end while
}//end ProcessIO
"
when i call this fonction if (HIDRxReport(Buffer,PacketSize ) > 0) this is the code in hid.c void
HIDTxReport(char *buffer, byte len)
{
byte i;
/*
* Value of len should be equal to or smaller than HID_INT_IN_EP_SIZE.
* This check forces the value of len to meet the precondition.
*/
if(len > HID_INT_IN_EP_SIZE)
len = HID_INT_IN_EP_SIZE;
/*
* Copy data from user's buffer to dual-ram buffer
*/
for (i = 0; i < len; i++)
hid_report_in = buffer;
HID_BD_IN.Cnt = len;
mUSBBufferReady(HID_BD_IN);
}//end HIDTxReport
---------- Post added at 10:19 ---------- Previous post was at 10:01 ----------
i find a solution
in my vb.net application i have to put BufferOut(index) = 0
like this
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Select Case ComboBox1.Text
Case "bloquant"
BufferOut(1) = Asc("b")
BufferOut(2) = Asc("l")
BufferOut(3) = Asc("o")
BufferOut(4) = Asc("q")
BufferOut(5) = Asc("u")
BufferOut(6) = Asc("a")
BufferOut(7) = Asc("n")
BufferOut(8) = Asc("t")
BufferOut(9) = Asc("*")
BufferOut(10) = Asc("t")
BufferOut(11) = Asc("e")
BufferOut(12) = Asc("s")
BufferOut(13) = Asc("t")
BufferOut(14) = 0
Call WriteSomeData()
and it works
thinks any way