Announcement

Collapse
No announcement yet.

Accessing USBDeviceState variable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Darrel Taylor
    replied
    USBDeviceState is a variable that is declared in ASM, so you can use it as an EXTernal variable.
    And CONFIGURED_STATE can be used as an EXTernal constant.
    Code:
    USBDeviceState     VAR BYTE EXT      ; USB drivers current State
    CONFIGURED_STATE   CON EXT           ; state when PIC is connected to PC
    Then your IF statement will work.

    Leave a comment:


  • Soundchaser
    started a topic Accessing USBDeviceState variable

    Accessing USBDeviceState variable

    I'm using PBP3 with a PIC18F4550. I am including USB18 files for a HID device.

    How do I access the assembly language variable USBDeviceState from the PBP source file? USBDeviceState is defined in usb_mem.asm. I would like to check it in the BASIC code to see if I'm connected to a host computer.

    Various bits are set in USBDeviceState to indicate the connected status.

    I am trying this:
    IF (USBDeviceState & CONFIGURED_STATE) THEN

    The PBP compiler generates a Bad Expression error

    Do I have to use ASM... ENDASM to do this?
Working...
X