Posted: Sun Mar 11, 2018 3:16 am Post subject: Send String over USB instead Byte
Hallo,
it is possible send string over usb instead Byte with usb.inc file?
Code:
Sub Hid_task() If Usb_connected =1Then' Check USB HID is enumerated
Usb_select_endpoint Ep_hid_out ' Get Data Repport From Host If Ueintx.rxouti =1Then' Is_usb_receive_out())
Dummy1 = Uedatx :Print"Got : "; Dummy1
Dummy2 = Uedatx :Print"Got : "; Dummy2
Dummy= Uedatx :Print"Got : ";Dummy Dummy= Uedatx :Print"Got : ";Dummy Dummy= Uedatx :Print"Got : ";Dummy Dummy= Uedatx :Print"Got : ";Dummy Dummy= Uedatx :Print"Got : ";Dummy Dummy= Uedatx :Print"Got : ";Dummy
Usb_ack_receive_out
End If
If Dummy1 =&H55 And Dummy2 =&HAA Then' Check if we received DFU mode command from host
Usb_detach ' Detach Actual Generic Hid Application Waitms500 Goto&H1800 'goto bootloader 'here you could call the bootloader then End If
Usb_select_endpoint Ep_hid_in ' Ready to send these information to the host application If Ueintx.txini =1Then' Is_usb_in_ready())
Uedatx =1
Uedatx =2
Uedatx =3
Uedatx ="Here i want send Text"'<-- for example!!! is it possible??
Uedatx =5
Uedatx =6
Uedatx =7
Uedatx =8
Usb_ack_fifocon ' Send data over the USB End If End If EndSub
(BASCOM-AVR version : 2.0.8.0 , Latest : 2.0.8.1 )
you can send strings since these are just bytes terminated with a zero byte.
for example :
Code:
total_length=len(somestring)+1 for j=1to total_length
Uedatx =asc(somestring, J)'get byte from string and send it next
you should however take in mind the length of the end point. in the sample it is 8. so to keep it working the string length is limited to 7.
the next step would be to send multiple packets. and/or to use bigger end points. _________________ Mark
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum