In the USBhid.bas there is not a reference to some of the code the easyhid creates such as:
TXReportRAM error identifier not declared
RXReportRAM same
ReadReport same
WriteReport same
These are listed in the Help file but don't show up in the code explorer under usbhid.
I have the full version of SF 2.0.2.0
Am I diong something wrong here?
Code: Select all
// device and clock...
device = 18F2450
clock = 48
// 20Mhz crystal, 48Mhz internal (FS USB)
config
PLLDIV = 5,
CPUDIV = OSC1_PLL2,
USBDIV = 2,
FOSC = HSPLL_HS,
VREGEN = ON
// this is the programs descriptor, generated by EasyHID - you
// can find it in the same folder as this program...
#option USB_DESCRIPTOR = "NotBustedDesc.bas"
// import the HID module...
include "usbhid.bas"
// an example TX report structure, which contains a message
// string and two word values - the variable TXReport will overlay
// the structure over the USB dual port RAM buffer...
structure TTXReport
Message as string
ValueA as word
ValueB as word
end structure
dim TXReport as TTXReport absolute TXReportRAM
// an example RX report structure, which contains some bit
// value and a configuration byte - the variable RXReport will overlay
// the structure over the USB dual port RAM buffer...
structure TRXReport
LED0 as bit
LED1 as bit
Configuration as byte
end structure
dim RXReport as TRXReport absolute RXReportRAM
// rather than using the above structures, you can read and write data
// directly into a buffer array - choose which method you prefer - examples
// are given in the main program block...
dim Buffer(32) as byte
// connect to USB...
repeat
until Attached
// the main program loop shows two different ways in which you can read and
// write HID data. The ReadReport() and WriteReport() techniques are very useful
// when sending and receiving highly structured data (for example, string, bits,
// words etc). If you just want to send and receive blocks of bytes, then
// ReadArray() and WriteArray() are probably more useful - you can of course
// use both ways!
while true
// this is one way you can read some HID data...
if DataAvailable then
ReadReport
// the data is now in our RX structure - for example, PORTD.0 = RXReport.LED0 etc...
// Alternatively, you can access the buffer directly as an array. For example,
// HID.RXReport(0), HID.RXReport(1)...
endif
// rather than using ReadReport(), as shown above, you can read data directly
// into a buffer array. For example,
if DataAvailable then
ReadArray(Buffer,10)
endif
// this is one way you can write some HID data...
TXReport.Message = "Hello World"
TXReport.ValueA = $1234
TXReport.ValueB = $0000
WriteReport
// rather than using WriteReport(), as shown above, you can write data directly
// into a buffer array. For example,
Buffer(0) = 0
Buffer(1) = 1
WriteArray(Buffer,2)
wend
Thanks
Doug