Mikroelektronika MIKROE-724 データシート

ページ / 726
634
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
Gen_Enable
Prototype
sub procedure Gen_Enable(dim readbuff as ^byte, dim writebuff as ^byte)
Description Initialize the USB module of the MCU.
Parameters 
readbuff
: Read Buffer. 
writebuff
: Write Buffer. 
Returns
Nothing.
Requires
USB needs to be enabled before using this function. See HID_Enable.
Example
Gen_Enable(@readbuff,@writebuff)
Notes
None.
Gen_Read
Prototype
sub function Gen_Read(dim readbuff as ^byte, dim length as byte, dim ep as 
byte) as byte
Description Generic routine that receives the specified data from the specified endpoint.
Parameters 
readbuff
: Received data. 
length
: The length of the data that you wish to receive. 
-
 ep
: Endpoint number you want to receive the data into. 
Returns
Returns the number of received bytes, otherwise 0.
Requires
USB needs to be enabled before using this function. See HID_Enable.
Example
while(Gen_Read(@readbuff,64,1) = 0)
wend
Notes
None.
Gen_Write
Prototype
sub function Gen_Write(dim writebuff as ^byte, dim as length as byte, dim 
ep as byte) as byte
Description Sends the specified data to the specified endpoint.
Parameters 
writebuff
: The data that you want to send. 
-
 length
: the length of the data that you wish to send. 
ep
: Endpoint number you want to send the data into.  
Returns
Returns the number of transmitted bytes, otherwise 0.
Requires
USB needs to be enabled before using this function. See HID_Enable.
Example
while(Gen_Write(@writebuff,64,1) = 0)
wend
Notes
None.