User manual
mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
634
Library Example
This example establishes connection with the HID terminal that is active on the PC. Upon connection establishment, the HID
Device Name will appear in the respective window. After that software will wait for data and it will return received data back.
Examples uses USBdsc.mpas descriptor le, which is in the same folder, and can be created by the HID Terminal.
Copy Code To Clipboard
program HID_Read_Write;
var cnt : char;
var readbuff : array[64] of char;
var writebuff : array[64] of char;
procedure USB1Interrupt(); iv IVT_ADDR_USB1INTERRUPT;
begin
USB_Interrupt_Proc();
end;
begin
AD1PCFGL := 0xFFFF;
HID_Enable(@readbuff,@writebuff);
while TRUE do
begin
while(HID_Read() = 0) do
;
for cnt:=0 to 63 do
writebuff[cnt] := readbuff[cnt];
while(HID_Write(@writebuff,64) = 0) do
;
end;
end.
HW Connection
USB connection scheme