Mikroelektronika MIKROE-724 データシート

ページ / 726
632
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
HID_Enable
Prototype
sub procedure HID_Enable(dim readbuff as ^byte, dim writebuff as ^byte)
Description Enables USB HID communication.
Parameters 
readbuff
: Read Buffer. 
writebuff
: Write Buffer. 
These parameters are used for HID communication.
Returns
Nothing.
Requires
Nothing.
Example
HID_Enable(@readbuff,@writebuff)
Notes
This function needs to be called before using other routines of USB HID Library.
HID_Read
Prototype
sub function HID_Read() as byte
Description Receives message from host and stores it in the Read Buffer.
Parameters None.
Returns
If  the  data  reading  has  failed,  the  function  returns  0.  Otherwise,  it  returns  number  of  characters 
received from the host.
Requires
USB HID needs to be enabled before using this function. See HID_Enable.
Example
while(HID_Read() = 0)
wend
Notes
None.
HID_Write
Prototype
sub function HID_Write(dim writebuff as ^byte, dim len as byte) as byte
Description Function sends data from Write Buffer 
writebuff
 to host.
Parameters -
 writebuff
: Write Buffer, same parameter as used in initialization; see HID_Enable. 
len
: specifies a length of the data to be transmitted. 
Returns
If the data transmitting has failed, the function returns 0. Otherwise, it returns number of transmitted 
bytes.
Requires
USB HID needs to be enabled before using this function. See HID_Enable.
Example
while(HID_Write(@writebuff,64) = 0)
wend
Notes
Function call needs to be repeated as long as data is not successfuly sent.