BBC BASIC for Windows
« USB HID »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:13pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: USB HID  (Read 1816 times)
wyzeowl
New Member
Image


member is offline

Avatar




PM


Posts: 5
xx USB HID
« Thread started on: Oct 26th, 2010, 5:20pm »

Hi Folks
I need to communicate with a usb HID. can anyone point me in the right direction.
Cheers
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: USB HID
« Reply #1 on: Oct 26th, 2010, 9:53pm »

on Oct 26th, 2010, 5:20pm, wyzeowl wrote:
I need to communicate with a usb HID.

The way I know it's been done successfully is by using this DLL:

http://www.kadtronix.com/usbhidapi.htm

Unfortunately it's not free (it costs $39) but I'm reliably informed it makes the task very easy.

In principle you can probably do it directly from BB4W code, but I'm not aware of anybody having achieved it.

Richard.
User IP Logged

dynamic35
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 34
xx Re: USB HID / USB Silicon lab
« Reply #2 on: Mar 30th, 2011, 9:21pm »

I have seen VB declaration:
Public Declare Function SI_Open Lib "SiUSBXp.dll" (ByVal dwDevice As UInt32, ByRef cyHandle As UInt32) As Integer

I can use BBC to read serial real time information along COM1...COM19 (thanks to many examples, advices by Richard in many discussions and manuals etc.) However, I am unable to read and write in my BBC4w program any information that moves in or out via my PC's USB port

That Siusbxp.dll ,I have in my pc now. How to change that VB statement into suitable format in BBC4w?
Rgs from Finland




« Last Edit: Mar 30th, 2011, 9:24pm by dynamic35 » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: USB HID / USB Silicon lab
« Reply #3 on: Mar 30th, 2011, 9:45pm »

on Mar 30th, 2011, 9:21pm, dynamic35 wrote:
I have seen VB declaration:
Public Declare Function SI_Open Lib "SiUSBXp.dll" (ByVal dwDevice As UInt32, ByRef cyHandle As UInt32) As Integer
How to change that VB statement into suitable format in BBC4w?

Code:
      SYS "LoadLibrary", "SiUSBXp.dll" TO siusbxp%
      SYS "GetProcAddress", siusbxp%, "SI_Open" TO SI_Open 

Alternatively you can use Jon Ripley's LoadDLL library to do the same thing more neatly:

Code:
      SI_Open = FN_LoadDLL("SiUSBXp.dll","SI_Open") 

In either case you would call the function as follows:

Code:
      SYS SI_Open, dwDevice%, ^cyHandle% TO result% 

Richard.
User IP Logged

dynamic35
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 34
xx Re: USB HID
« Reply #4 on: Mar 30th, 2011, 9:48pm »

THank you again very much..
User IP Logged

dynamic35
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 34
xx Re: USB HID
« Reply #5 on: Apr 4th, 2011, 9:32pm »

on Mar 30th, 2011, 9:48pm, dynamic35 wrote:
THank you again very much..

This another finding from internet below is more complicated. How could this be written in BBC Basic?

Private Declare Function SI_Write Lib "SiUSBXp.dll" (ByVal handle As Long, ByVal Buffer As Long, ByVal NumBytesToWrite As Long, ByRef NumBytesWritten As Long) As Long

So I am trying to use an usb port instead of classical COM1 that was opened for random binary input output
19200, 8,N,1 . Silicon Labs driver

Rgs d mic

Ref discussions from
http://www.cygnal.org/ubb/Forum9/HTML/000811.html
« Last Edit: Apr 4th, 2011, 9:35pm by dynamic35 » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: USB HID
« Reply #6 on: Apr 4th, 2011, 9:43pm »

on Apr 4th, 2011, 9:32pm, dynamic35 wrote:
How could this be written in BBC Basic?
Code:
Private Declare Function  SI_Write Lib "SiUSBXp.dll" (ByVal handle As Long, ByVal Buffer As Long, ByVal NumBytesToWrite As Long, ByRef NumBytesWritten As Long) As Long 


To call that function in BBC BASIC you would do:

Code:
SYS SI_Write, handle%, Buffer%, NumBytesToWrite%, ^NumBytesWritten% TO result% 

(having previously set Buffer% to point to the data to be written).

Richard.
User IP Logged

dynamic35
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 34
xx Re: USB HID
« Reply #7 on: Apr 10th, 2011, 7:40pm »

The CP210x USB to UART Bridge Virtual COM Port (VCP) drivers are required for device operation as a Virtual COM Port to facilitate host communication with CP210x products. The command like this
port% = OPENUP("COM3: baud=19200 parity=N data=8 stop=1")
works well then if a serial equipment is pushed into an USB 'hole' in a PC.

In my Xp there must be found then- under device manager /system- COM & LPT port a following driver:
Silicon Labs CP210X USB Uart Bridge (COM 3)

My question is how to put/call into a BBC Basic program that Silicon labs driver?
cp2010x. manufacturing.dll such that the user has no need to install him/herself the driver under his/her system?
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls