Quantcast
Channel: MCS Electronics Forum
Viewing all 20563 articles
Browse latest View live

BASCOM-AVR : Xmega SH1106 Oled display : REPLY

$
0
0
Example Atmega 16A.... [code:1:6ad27129af]Config Portd.7 = Output : Led Alias Portd.7 Do Toggle Led : Waitms 1000 Loop End [/code:1:6ad27129af] :D

BASCOM-AVR : Xmega SH1106 Oled display : REPLY

$
0
0
Library for SSD1306, for example, had to be updated for work with Xmegas. So I'm guessing your library can have the same problem. Maybe compare this two can be useful to find solution but you should also start with newest Bascom version 2080...

BASCOM-AVR : Xmega SH1106 Oled display : REPLY

$
0
0
I think your led does not blink because you never get an answer from the display on the LCdat commands... I got the same problem on a KS108 device. The LCD was damaged and software never passed the Lcdat command... I think it stayed in a loop, waiting for the LCD reply. A new LCD solved the problem. If you are sure that your hardware is ok, maybe you have a speed or configuration problem. Another thing, please use the "Code" tag to delimit your examples. It's more readable. JB

Share your working BASCOM-AVR code here : hx8357c 480x320 display : REPLY

$
0
0
Thanks for library hx8357 [/img]

Share your working BASCOM-AVR code here : hx8357c 480x320 display : REPLY

$
0
0
Looks very nice. Have fun Ben Zijlstra

BASCOM-AVR : Xmega SH1106 Oled display : REPLY

$
0
0
Graphics libraries with I2C connected Displays that work for Megas might not work for Xmegas. I had that issue with the "glcdEADOGMXL240-7-I2C.lib". The EADOGMXL240-7 does not work with Xmegas. I had asked here some time ago for a fix but there was no answer.... Best regards, Meister

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
Hello, do i need a 16MHz Crystal or can i use a 8MHz? Because i cant get run it with 8MHz. Flip-Bootloader works on my Hardware.

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
which chip do you use? usb162 also supports 8 Mhz. the usb clock code is in the Macro Pll_start_auto in usbinc.bas it is important that you have the $crystal set to 8000000 since the macro depends on it.

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
Hi, at moment i use a M32u2 @ 8MHz. m32u2def.dat-File I use the example for hid_keyboard origin for U4. If i plug in my board, i got a "bing" for connect and a next "bing" for disconnect. I use a USB-Hub with LED. This light on by connection. With the FLIP-Bootloder its on, and i can transfer my Files to the Chip with Bascom. But the Exaple dont work! [code:1:6c0ff19593] '------------------------------------------------------------------------------ ' (c) 1995-2008 MCS Electronics ' hid_keyboard-M324U.bas ' generic HID input and output sample, based on Atmels sample '------------------------------------------------------------------------------ $regfile = "m32u2def.dat" $crystal = 8000000 'crystal used $baud = 19200 ' baud rate $hwstack = 64 $swstack = 64 $framesize = 128 Const Mdbg = 0 ' add print to see what is happening Const Chiddevice = 1 'this is a HID device Config Clockdiv = 1 'clock division is 1 so we get 8 Mhz Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 Print "USB test" 'User specific declarations Declare Sub Usb_user_endpoint_init() ' since no param is passed in the atmel code the param is removed Declare Sub Kbd_test_hit() Declare Sub Kbd_task() Declare Sub Sendtokbd(byval Dta As String * 80) Const Usb_config_attributes_reserved = &H80 Const Usb_config_buspowered = Usb_config_attributes_reserved Const Usb_config_selfpowered = Usb_config_attributes_reserved Or &H40 Const Usb_config_remotewakeup = Usb_config_attributes_reserved Or &H20 Const Nb_interface = 1 Const Conf_nb = 1 Const Conf_index = 0 'Const Conf_attributes = Usb_config_buspowered 'if you like to support sleep mode use this Const Usb_remote_wakeup = 1 'enable remote wakeup Const Conf_attributes = Usb_config_buspowered + Usb_config_remotewakeup Const Max_power = 50 ' 100 mA Const Interface_nb_mouse = 0 Const Alternate_mouse = 0 Const Nb_endpoint_mouse = 1 Const Interface_class_mouse = 3 ' HID Class Const Interface_sub_class_mouse = 1 ' Sub Class is Mouse Const Interface_protocol_mouse = 2 ' Mouse Const Interface_index_mouse = 0 Const Ep_control_length = 32 Const User_conf_size = 34 ' total user size Const Size_of_report = 59 ' HID report size Const Vendor_id = &H16D0 ' vendor ID Const Product_id = &H2000 ' product ID Const Release_number = &H1000 ' product release Const Device_class = 0 Const Device_sub_class = 0 Const Nb_endpoints = 2 ' number of endpoints in the application including control endpoint Const Ep_kbd_in = 1 ' Number of the mouse interrupt IN endpoint Const Endpoint_nb_1 = Ep_kbd_in Or &H80 Const Ep_attributes_1 = 3 ' BULK = 0x02, INTERUPT = 0x03 Const Ep_in_length_1 = 8 Const Ep_size_1 = Ep_in_length_1 Const Ep_interval_1 = 2 'Interrupt polling interval from host Config Usb = Device , Language = &H0409 , Manufact = "MCS" , Product = "MCSUSB162" , Serial = "MC000" Dim Usb_kbd_state As Byte , Usb_key As Byte , Usb_data_to_send As Byte Dim Key_hit As Bit , Transmit_no_key As Bit Config PinD.7 = Input : PortD.7 = 1 ' lets use pinb.0 for the input Config PinD.6 = Input : PortD.6 = 1 ' use pinb.1 to get PC out of sleep Print "init usb task" Usb_task_init Do Usb_task If Inkey() = 32 Or PinD.7 = 0 Then 'if you press SPACE BAR Print "Set focus to notepad" Wait 3 ' give user some time to do it Sendtokbd "test THIS 123" Print "done" End If 'call your other code here If Pinb.1 = 0 Then Print "wake up PC" Usb_generate_remote_wakeup End If Loop Sub Sendtokbd(byval Dta As String * 80) Local J As Byte , Key As Byte , Hidmod As Byte Uenum = Ep_kbd_in 'select end point If Ueintx.txini = 1 Then ' Is_usb_read_control_enabled ? Key_hit = 0 End If If Key_hit = 0 And Usb_configuration_nb <> 0 Then For J = 1 To Len(dta) Hidmod = Hid_modifier_none Bitwait Ueintx.txini , Set 'wait till ready Key = Asc(dta , J) 'ASCII value If Key >= "a" And Key <= "z" Then 'lower case Key = Key - 93 Elseif Key >= "A" And Key <= "Z" Then 'upper Key = Key - 61 Hidmod = Hid_modifier_none + Hid_modifier_left_shift Elseif Key = 32 Then 'space Key = &H2C Elseif Key = "0" Then Key = &H27 Elseif Key >= "1" And Key <= "9" Then 'number Key = Key - 19 Else Exit Sub 'not implemented !!! End If Uenum = Ep_kbd_in Uedatx = Hidmod ' Byte0: Modifier use this to send shift,ctrl and alt keys Uedatx = 0 ' Byte1: Reserved Uedatx = Key ' Byte2: Keycode 0 Uedatx = 0 ' Byte3: Keycode 1 Uedatx = 0 ' Byte4: Keycode 2 Uedatx = 0 ' Byte5: Keycode 3 Uedatx = 0 ' Byte6: Keycode 4 Uedatx = 0 ' Byte7: Keycode 5 Usb_ack_in_ready Bitwait Ueintx.txini , Set 'wait till ready Uenum = Ep_kbd_in Uedatx = 0 Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Usb_ack_in_ready Next End If End Sub 'USER function Sub Usb_user_endpoint_init() Call Usb_configure_endpoint(ep_kbd_in , Type_interrupt , Direction_in , Size_8 , One_bank , Nyet_enabled) 'we have only 1 end point End Sub Function Usb_user_read_request(type As Byte , Request As Byte)as Byte #if Mdbg Print "USB_USER_READ_REQ" #endif Usb_string_type = Uedatx ' Usb read byte Usb_descriptor_type = Uedatx ' Usb read byte Usb_user_read_request = 0 Select Case Request Case Get_descriptor: Select Case Usb_descriptor_type Case Report : Call Hid_get_report() Usb_user_read_request = 1 Case Hid : Call Hid_get_hid_descriptor() Usb_user_read_request = 1 Case Else Usb_user_read_request = 0 End Select Case Set_configuration: Select Case Usb_descriptor_type Case Set_report : Call Hid_set_report() Usb_user_read_request = 1 Case Else Usb_user_read_request = 0 End Select Case Get_interface: '// usb_hid_set_idle(); Call Usb_hid_get_interface() Usb_user_read_request = 1 Case Else Usb_user_read_request = 0 End Select End Function 'usb_init_device. 'This function initializes the USB device controller and 'configures the Default Control Endpoint. Sub Usb_init_device() #if Usbhost Usb_select_device #endif #if _chip = 70 Or _chip = 71 'if usb1287 or usb646 If Usbsta.id = 1 Then 'is it an USB device? #endif Uenum = Ep_control ' select USB endpoint If Ueconx.epen = 0 Then ' usb endpoint not enabled yet Call Usb_configure_endpoint(ep_control , Type_control , Direction_out , Size_32 , One_bank , Nyet_disabled) End If #if _chip = 70 Or _chip = 71 'if usb1287 or usb646 End If #endif End Sub Usb_dev_desc: Data 18 , Device_descriptor ' size and device_descriptor Data 0 , 2 ' Usb_write_word_enum_struc(USB_SPECIFICATION) Data Device_class , Device_sub_class ' DEVICE_CLASS and DEVICE_SUB_CLASS Data 0 , Ep_control_length ' device protol and ep_control_length Data Vendor_id% ' Usb_write_word_enum_struc(VENDOR_ID) Data Product_id% ' Usb_write_word_enum_struc(PRODUCT_ID) Data Release_number% ' Usb_write_word_enum_struc(RELEASE_NUMBER) Data Man_index , Prod_index ' MAN_INDEX and PROD_INDEX Data Sn_index , Nb_configuration ' SN_INDEX NB_CONFIGURATION Usb_conf_desc: Data 9 , Configuration_descriptor ' length , CONFIGURATION descriptor type Data User_conf_size% ' total length of data returned Data Nb_interface , Conf_nb ' number of interfaces for this conf. , value for SetConfiguration resquest Data Conf_index , Conf_attributes ' index of string descriptor , Configuration characteristics Data Max_power ' maximum power consumption Data 9 , Interface_descriptor ' size of this descriptor ,INTERFACE descriptor Data Interface_nb_mouse , Alternate_mouse ' Number of interface , value to select alternate setting Data Nb_endpoint_mouse , Interface_class_mouse ' Number of EP except EP 0 ,Class code assigned by the USB Data Interface_sub_class_mouse , Interface_protocol_mouse ' Sub-class code assigned by the USB ,Protocol code assigned by the USB Data Interface_index_mouse ' Index of string descriptor Data 9 , Hid_descriptor ' Size of this descriptor , HID descriptor type Data &H01 , &H10 , Hid_country_code ' Binay Coded Decimal Spec. release , Hardware target country Data Hid_class_desc_nb , Hid_descriptor_type ' number of HID class descriptors to follow , Report descriptor type Data Size_of_report% ' total length of report descriptor Data 7 , Endpoint_descriptor ' Size Of This Descriptor In Bytes , ENDPOINT descriptor type Data Endpoint_nb_1 , Ep_attributes_1 ' Address of the endpoint , Endpoint's attributes Data Ep_size_1% ' Maximum packet size for this EP Data Ep_interval_1 ' Interval for polling EP in ms Usb_hid_report: Data &H05 , &H01 ' Usage Page (Generic Desktop) Data &H09 , &H06 ' Usage (Keyboard) Data &HA1 , &H01 ' Collection (Application) Data &H05 , &H07 ' Usage Page (Keyboard) Data &H19 , 224 ' Usage Minimum (224) Data &H29 , 231 ' Usage Maximum (231) Data &H15 , &H00 ' Logical Minimum (0) Data &H25 , &H01 ' Logical Maximum (1) Data &H75 , &H01 ' Report Size (1) Data &H95 , &H08 ' Report Count (8) Data &H81 , &H02 ' Input (Data, Variable, Absolute) Data &H81 , &H01 ' Input (Constant) Data &H19 , &H00 ' Usage Minimum (0) Data &H29 , 101 ' Usage Maximum (101) Data &H15 , &H00 ' Logical Minimum (0) Data &H25 , 101 ' Logical Maximum (101) Data &H75 , &H08 ' Report Size (8) Data &H95 , &H06 ' Report Count (6) Data &H81 , &H00 ' Input (Data, Array) Data &H05 , &H08 ' Usage Page (LED) Data &H19 , &H01 ' Usage Minimum (1) Data &H29 , &H05 ' Usage Maximum (5) Data &H15 , &H00 ' Logical Minimum (0) Data &H25 , &H01 ' Logical Maximum (1) Data &H75 , &H01 ' Report Size (1) Data &H95 , &H05 ' Report Count (5) Data &H91 , &H02 ' Output (Data, Variable, Absolute) Data &H95 , &H03 ' Report Count(3) Data &H91 , &H01 ' Output(constant) Data &HC0 ' End Collection [/code:1:6c0ff19593]

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
Fuses: $PROG &HFF,&HC0,&HD9,&HF6

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
- you can best say which fuses you altered from the default. - what kind of hardware you use? - try the virtcom-m32u2.bas demo which was made for 32u2 , Const Mdbg = 1 should be set to 0. - since flip works i assume you use a real xtal. - more important : do you have a voltage divider on Pinc.4 ? Like described in the pdf? This acts as bus detection.

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
- fuse are the same like by FLIP works - my own. ATMEGA to USB. 3V3-Voltage regulator for ext. Oscillator - yes! It starts with trying to install a Driver. A second time, it dont work anymore. - its a osc. 8MHz - No! on PinC.4 i have a Switch. Witch PDF you mean?

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
Ok, now i have continue! My Windows find the USB-Stick! But the Vendor and PID are one time usable! If i change it, i got device-manager he try to instrall a driver. After a second my USB-Stick is gone, the device-manager tells me "hardware removed" and a second time with the same PID and VID dont work anymore. My goal: Pressing a Button on PinD.7 sends me a Keyboardstring. Its "F4" to start Bascom Chip programming with a food-paddle ;-) my prob: The deive is gone after a second. what can i do? code with pid and vid works one time for the device-manager: [code:1:812a03120d]'------------------------------------------------------------------------------ ' (c) 1995-2009 MCS Electronics ' hid_keyboard-1287.bas ' generic HID input and output sample, based on Atmels sample '------------------------------------------------------------------------------ $regfile = "m32u2def.dat" $crystal = 8000000 'crystal used $baud = 19200 ' baud rate $hwstack = 64 $swstack = 64 $framesize = 64 Const Mdbg = 0 ' add print to see what is happening Const Chiddevice = 1 'this is a HID device Config Clockdiv = 1 'clock division is 1 so we get 8 Mhz Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 Print "USB test" 'User specific declarations Declare Sub Usb_user_endpoint_init 'since no param is passed in the atmel code the param is removed Declare Sub Kbd_test_hit() Declare Sub Kbd_task() Const Usb_remote_wakeup = 0 Const Usb_config_attributes_reserved = &H80 Const Usb_config_buspowered = Usb_config_attributes_reserved Const Usb_config_selfpowered = Usb_config_attributes_reserved Or &H40 Const Usb_config_remotewakeup = Usb_config_attributes_reserved Or &H20 Const Nb_interface = 1 Const Conf_nb = 1 Const Conf_index = 0 Const Conf_attributes = Usb_config_buspowered + Usb_config_remotewakeup Const Max_power = 50 ' 100 mA Const Interface_nb_mouse = 0 Const Alternate_mouse = 0 Const Nb_endpoint_mouse = 1 Const Interface_class_mouse = 3 ' HID Class Const Interface_sub_class_mouse = 1 ' Sub Class is Mouse Const Interface_protocol_mouse = 2 ' Mouse Const Interface_index_mouse = 0 Const Ep_control_length = 32 Const User_conf_size = 34 ' total user size Const Size_of_report = 59 ' HID report size Const Vendor_id = &H045E ' vendor ID Const Product_id = &H0752 ' product ID Const Release_number = &H1000 ' product release Const Device_class = 0 Const Device_sub_class = 0 Const Nb_endpoints = 2 ' number of endpoints in the application including control endpoint Const Ep_kbd_in = 1 ' Number of the mouse interrupt IN endpoint Const Endpoint_nb_1 = Ep_kbd_in Or &H80 Const Ep_attributes_1 = 3 ' BULK = 0x02, INTERUPT = 0x03 Const Ep_in_length_1 = 8 Const Ep_size_1 = Ep_in_length_1 Const Ep_interval_1 = 2 'Interrupt polling interval from host Config Usb = Device , Language = &H0409 , Manufact = "AWE" , Product = "PWUSB1" , Serial = "00001" Dim Usb_kbd_state As Byte , Usb_key As Byte , Usb_data_to_send As Byte Dim Key_hit As Bit , Transmit_no_key As Bit Config Pind.7 = Input : Portd.7 = 1 ' lets use pinb.0 for the input Print "init usb task" Usb_task_init Do Usb_task Kbd_task 'call your other code here Loop 'test if a key must be sent Sub Kbd_test_hit() Select Case Usb_kbd_state Case 0: ' if we are not in the middle of sending data If Inkey() = 32 Or Pind.7 = 0 Then 'if you press SPACE BAR Print "Set focus to notepad" Wait 3 ' give user some time to do it Usb_kbd_state = 1 ' change state Restore Keys Usb_data_to_send = 15 Elseif Inkey() = "*" Then Print "Reboot" Usb_detach ' Detach Actual Generic Hid Application Waitms 500 Goto &H1FC00 ' boot loader End If Case 1: ' we need to send data If Usb_data_to_send <> 0 Then If Key_hit = 0 And Transmit_no_key = 0 Then Read Usb_key ' read data Decr Usb_data_to_send Key_hit = 1 End If Else Usb_kbd_state = 0 End If End Select End Sub 'checkout the Microsoft document translatePS2-HID.pdf Keys: Data 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 'check this procedure once in awhile Sub Kbd_task() Uenum = Ep_kbd_in If Ueintx.txini = 1 Then ' Is_usb_read_control_enabled ? Key_hit = 0 End If ' if USB ready to transmit new data : ' - if last time = 0, nothing ' - if key pressed -> transmit key ' - if !key pressed -> transmit 0 If Key_hit = 0 And Usb_configuration_nb <> 0 Then Kbd_test_hit 'check for key pressed or sending data Bitwait Ueintx.txini , Set If Key_hit = 1 Then 'wait for the data Transmit_no_key = 1 Uenum = Ep_kbd_in Uedatx = Hid_modifier_none ' Byte0: Modifier use this to send shift,ctrl and alt keys Uedatx = 0 ' Byte1: Reserved Uedatx = Usb_key ' Byte2: Keycode 0 Uedatx = 0 ' Byte2: Keycode 1 Uedatx = 0 ' Byte2: Keycode 2 Uedatx = 0 ' Byte2: Keycode 3 Uedatx = 0 ' Byte2: Keycode 4 Uedatx = 0 ' Byte2: Keycode 5 Usb_ack_in_ready Exit Sub End If If Transmit_no_key = 1 Then ' if this flag was set Key_hit = 1 'make it one so we can send the next key after we are done sending 0 Transmit_no_key = 0 Uenum = Ep_kbd_in Uedatx = 0 Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Uedatx = 0 ' Usb write byte Usb_ack_in_ready End If End If End Sub 'USER function Sub Usb_user_endpoint_init() Call Usb_configure_endpoint(ep_kbd_in , Type_interrupt , Direction_in , Size_8 , One_bank , Nyet_enabled) End Sub Function Usb_user_read_request(type As Byte , Request As Byte)as Byte #if Mdbg Print "USB_USER_READ_REQ" #endif Usb_string_type = Uedatx ' Usb read byte Usb_descriptor_type = Uedatx ' Usb read byte Usb_user_read_request = 0 Select Case Request Case Get_descriptor: Select Case Usb_descriptor_type Case Report : Call Hid_get_report() Usb_user_read_request = 1 Case Hid : Call Hid_get_hid_descriptor() Usb_user_read_request = 1 Case Else Usb_user_read_request = 0 End Select Case Set_configuration: Select Case Usb_descriptor_type Case Set_report : Call Hid_set_report() Usb_user_read_request = 1 Case Else Usb_user_read_request = 0 End Select Case Get_interface: '// usb_hid_set_idle(); Call Usb_hid_get_interface() Usb_user_read_request = 1 Case Else Usb_user_read_request = 0 End Select End Function 'usb_init_device. 'This function initializes the USB device controller and 'configures the Default Control Endpoint. Sub Usb_init_device() #if Usbhost Usb_select_device #endif #if _chip = 70 Or _chip = 71 'if usb1287 or usb646 If Usbsta.id = 1 Then 'is it an USB device? #endif Uenum = Ep_control ' select USB endpoint If Ueconx.epen = 0 Then ' usb endpoint not enabled yet Call Usb_configure_endpoint(ep_control , Type_control , Direction_out , Size_32 , One_bank , Nyet_disabled) End If #if _chip = 70 Or _chip = 71 'if usb1287 or usb646 End If #endif End Sub Usb_dev_desc: Data 18 , Device_descriptor ' size and device_descriptor Data 0 , 2 ' Usb_write_word_enum_struc(USB_SPECIFICATION) Data Device_class , Device_sub_class ' DEVICE_CLASS and DEVICE_SUB_CLASS Data 0 , Ep_control_length ' device protol and ep_control_length Data Vendor_id% ' Usb_write_word_enum_struc(VENDOR_ID) Data Product_id% ' Usb_write_word_enum_struc(PRODUCT_ID) Data Release_number% ' Usb_write_word_enum_struc(RELEASE_NUMBER) Data Man_index , Prod_index ' MAN_INDEX and PROD_INDEX Data Sn_index , Nb_configuration ' SN_INDEX NB_CONFIGURATION Usb_conf_desc: Data 9 , Configuration_descriptor ' length , CONFIGURATION descriptor type Data User_conf_size% ' total length of data returned Data Nb_interface , Conf_nb ' number of interfaces for this conf. , value for SetConfiguration resquest Data Conf_index , Conf_attributes ' index of string descriptor , Configuration characteristics Data Max_power ' maximum power consumption Data 9 , Interface_descriptor ' size of this descriptor ,INTERFACE descriptor Data Interface_nb_mouse , Alternate_mouse ' Number of interface , value to select alternate setting Data Nb_endpoint_mouse , Interface_class_mouse ' Number of EP except EP 0 ,Class code assigned by the USB Data Interface_sub_class_mouse , Interface_protocol_mouse ' Sub-class code assigned by the USB ,Protocol code assigned by the USB Data Interface_index_mouse ' Index of string descriptor Data 9 , Hid_descriptor ' Size of this descriptor , HID descriptor type Data &H01 , &H10 , Hid_country_code ' Binay Coded Decimal Spec. release , Hardware target country Data Hid_class_desc_nb , Hid_descriptor_type ' number of HID class descriptors to follow , Report descriptor type Data Size_of_report% ' total length of report descriptor Data 7 , Endpoint_descriptor ' Size Of This Descriptor In Bytes , ENDPOINT descriptor type Data Endpoint_nb_1 , Ep_attributes_1 ' Address of the endpoint , Endpoint's attributes Data Ep_size_1% ' Maximum packet size for this EP Data Ep_interval_1 ' Interval for polling EP in ms Usb_hid_report: Data &H05 , &H01 ' Usage Page (Generic Desktop) Data &H09 , &H06 ' Usage (Keyboard) Data &HA1 , &H01 ' Collection (Application) Data &H05 , &H07 ' Usage Page (Keyboard) Data &H19 , 224 ' Usage Minimum (224) Data &H29 , 231 ' Usage Maximum (231) Data &H15 , &H00 ' Logical Minimum (0) Data &H25 , &H01 ' Logical Maximum (1) Data &H75 , &H01 ' Report Size (1) Data &H95 , &H08 ' Report Count (8) Data &H81 , &H02 ' Input (Data, Variable, Absolute) Data &H81 , &H01 ' Input (Constant) Data &H19 , &H00 ' Usage Minimum (0) Data &H29 , 101 ' Usage Maximum (101) Data &H15 , &H00 ' Logical Minimum (0) Data &H25 , 101 ' Logical Maximum (101) Data &H75 , &H08 ' Report Size (8) Data &H95 , &H06 ' Report Count (6) Data &H81 , &H00 ' Input (Data, Array) Data &H05 , &H08 ' Usage Page (LED) Data &H19 , &H01 ' Usage Minimum (1) Data &H29 , &H05 ' Usage Maximum (5) Data &H15 , &H00 ' Logical Minimum (0) Data &H25 , &H01 ' Logical Maximum (1) Data &H75 , &H01 ' Report Size (1) Data &H95 , &H05 ' Report Count (5) Data &H91 , &H02 ' Output (Data, Variable, Absolute) Data &H95 , &H03 ' Report Count(3) Data &H91 , &H01 ' Output(constant) Data &HC0 ' End Collection[/code:1:812a03120d]

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
With PDF i mean the USB.PDF which is inside the usb add on package. It explains that for certain chips portc.4 is used to determine if the device is plugged or not. So you need to connect portc.4 with a simple voltage divider which get the vcc from the usb bus : connect 2 47K in series from usb vcc to ground and connect the middle to portc.4 If you change the vid/pid, windows will install a new driver. For some drivers like HID, it does not need an external driver. For others like CDC you must change the inf file. This is also explained in the usb.pdf A foot pedal with F4 is a super idea ! I recommend to fix the portc4 first. Or you can alter usbinc file to use a different port pin. If you still have problems, check if you have connected right : bus powered device vs self powered device. And you could turn on debug to see what is happening.

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
Hello, thanks! I make PortC.4 = 1 then it works! Question, how i send a "enter" or a "F4" keypress?

BASCOM-AVR : HID with Mega8U2 and USB-Addon? : REPLY

$
0
0
It's in the source code: [code:1:c4fe45a38e] 'checkout the Microsoft document translatePS2-HID.pdf Keys: Data 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 [/code:1:c4fe45a38e] You can find the pdf in your addon directory.

BASCOM-AVR : USB Event connect/work : NEWTOPIC

$
0
0
Hello. I buy/use "BASCOM USB Add On". 1. An event is necessary in which the device determines its readiness for use. It is necessary to determine the readiness of the USB's work in the computer. The computer does not immediately detect the connected device, installs the driver, runs for a while and only then the system is ready to work with the USB device. Here you need to determine this state. Tried this state as follows: [code:1:8809c68169]If Usbsta.vbus = 1 And Usb_connected = 0 Then[/code:1:8809c68169] But this method does not work. 2. Another question: where can I download more detailed examples of using the library? ps: use ATmega32U4. [b:8809c68169][color=red:8809c68169](BASCOM-AVR version : 2.0.7.9 , Latest : 2.0.7.8 )[/b:8809c68169][/color:8809c68169]

BASCOM-AVR : USB Event connect/work : REPLY

$
0
0
[quote:f7528ddfee="Madf"]Hello. I buy/use "BASCOM USB Add On". 1. An event is necessary in which the device determines its readiness for use. It is necessary to determine the readiness of the USB's work in the computer. The computer does not immediately detect the connected device, installs the driver, runs for a while and only then the system is ready to work with the USB device. Here you need to determine this state. Tried this state as follows: [code:1:f7528ddfee]If Usbsta.vbus = 1 And Usb_connected = 0 Then[/code:1:f7528ddfee] But this method does not work. 2. Another question: where can I download more detailed examples of using the library? ps: use ATmega32U4. [b:f7528ddfee][color=red:f7528ddfee](BASCOM-AVR version : 2.0.7.9 , Latest : 2.0.7.8 )[/b:f7528ddfee][/color:f7528ddfee][/quote:f7528ddfee] You can try to send a message for merch support at least, they will expain by steps. OFFtop: Ну, мне помогли

BASCOM-AVR : USB Event connect/work : REPLY

$
0
0
Take a look into usbinc.bas. You can find a Sub "Usb_vbus_on_action()" with description "'sub is called when USB is connected" I think you can use it to set some flag in your project.

BASCOM-AVR : Xmega SH1106 Oled display : REPLY

$
0
0
I tested Hkipnik code and it works fine with Xmega. link: http://bascomforum.de/index.php?thread/120-ssd1306-oled-display-1-3-i2c-spi/ The code is quite slow, but its ok for me. The only problem is with True Type fonts. The Hkipnik code doesnt recognize TT fonts. The TT fonts are displayed without TT offset, they look like nomal fonts, without TT option. Can anyone help me with adding-on TT option to this code? The info about TT offset is read in line Dummy = Lookup(3 , My6_8), but how to use this to dispaly TT fonts correctly? [code:1:21ff9c0182]'******************************************************************************* 'LCD_Text String -- X -- Y Start -- Font '******************************************************************************* Sub Lcd_text(byval S As String , Xoffset As Byte , Yoffset As Byte , Fontset As Byte) Local Tempstring As String * 1 , Temp As Word Local A As Byte , Pixels As Byte , Count As Byte , Carcount As Byte , Lus As Byte Local Row As Byte , Block As Byte , Byteseach As Byte , Blocksize As Byte , Dummy As Byte Local Colums As Byte , Columcount As Byte , Rowcount As Byte , Stringsize As Byte Local Xpos As Byte , Ypos As Byte , Pixel As Word , Pixelcount As Byte Local Offset As Word Stringsize = Len(s) - 1 'Size of the text string -1 because we must start with 0 Select Case Fontset Case 1 : Block = Lookup(0 , My6_8) 'Add or remove here fontset's that you need or not, Byteseach = Lookup(1 , My6_8) Blocksize = Lookup(2 , My6_8) Dummy = Lookup(3 , My6_8) Case 2 : Block = Lookup(0 , My12_16) Byteseach = Lookup(1 , My12_16) Blocksize = Lookup(2 , My12_16) Dummy = Lookup(3 , My12_16) End Select Colums = Blocksize / Block 'Calculate the numbers of colums Row = Block * 8 'Row is always 8 pixels high = 1 byte, so working with row in steps of 8. Row = Row - 1 'Want to start with row=0 instead of 1 Colums = Colums - 1 'Same for the colums For Carcount = 0 To Stringsize 'Loop for the numbers of caracters that must be displayed Temp = Carcount + 1 'Cut the text string in seperate caracters Tempstring = Mid(s , Temp , 1) Offset = Asc(tempstring) - 32 'Font files start with caracter 32 Offset = Offset * Blocksize Offset = Offset + 4 Temp = Carcount * Byteseach Temp = Temp + Xoffset For Rowcount = 0 To Row Step 8 'Loop for numbers of rows A = Rowcount + Yoffset Xpos = Temp For Columcount = 0 To Colums 'Loop for numbers of Colums Select Case Fontset Case 1 : Pixels = Lookup(offset , My6_8) Case 2 : Pixels = Lookup(offset , My12_16) End Select Ypos = A For Pixelcount = 0 To 7 'Loop for 8 pixels to be set or not Pixel = Pixels.0 'Set the pixel (or not) If Pixel = 1 Then Call Lcd_set_pixel(xpos , Ypos , White) Else Call Lcd_set_pixel(xpos , Ypos , Black) End If Shift Pixels , Right 'Shift the byte 1 bit to the right so the next pixel comes availible Incr Ypos 'Each pixel on his own spot Next Pixelcount Incr Offset Incr Xpos 'Do some calculation to get the caracter on the correct Xposition Next Columcount Next Rowcount Next Carcount End Sub [/code:1:21ff9c0182]
Viewing all 20563 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>