New project - MSFS C++ USB interface


+ Reply to Thread
Results 1 to 40 of 170

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,161


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    How many buttons will be pressed at the same time?

    Maybe state machine is another good solution for such a project. I can dig out an example for small amount of buttons that I am sure can be expanded for more. the advantage is that no pause is used because it is out of the state machine philosophy of operation.

    Ioannis

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by Ioannis View Post
    How many buttons will be pressed at the same time?

    Maybe state machine is another good solution for such a project. I can dig out an example for small amount of buttons that I am sure can be expanded for more. the advantage is that no pause is used because it is out of the state machine philosophy of operation.

    Ioannis
    In theory, only one button gets pressed at a time.

    It's essentially a button box; something like this:

    https://i.ebayimg.com/images/g/AX0AA...D1/s-l1600.jpg
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,161


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Maybe then it is worth to try this:

    100 buttons means about 13 bytes.

    You can read that 13 bytes, store them in a temp array.

    Do whatever you want and a timer interrupt will get you back to read again the 13 bytes in about 10ms or whatever you want.

    Compare to the previous read in temp array. If there is a difference, you can jump to the appropriate sub using ON index GOTO or BRANCHL technique, for up to 127 or 1024 labels to goto.

    No pauses, no delays to the main program. An no 200 resistors and 100 capacitors along with a bunch of HC14's.

    Ioannis
    Last edited by Ioannis; - 14th January 2024 at 22:14.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by Ioannis View Post
    ...No pauses, no delays to the main program. An no 200 resistors and 100 capacitors along with a bunch of HC14's.

    That is an interesting technique worth looking into.

    I also have several rotary encoders. You can spin those around quite fast. Not sure that would work with this technique.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,666


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    i agree with ioannis ,all that extra hardware will not add much value [if any] when you need to keep track off switch states anyway


    I also have several rotary encoders. You can spin those around quite fast
    getting multiple re's to work glitch free when other interrupts are involved is very challenging


    these things work great and are open sourced or you can buy some


    https://www.tindie.com/products/saim...er-on-i2c-bus/
    Warning I'm not a teacher

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by richard View Post
    ...
    these things work great and are open sourced or you can buy some


    https://www.tindie.com/products/saim...er-on-i2c-bus/

    Now you're talking. I don't need all that RGB stuff, just rotary encoder with switch support is all I need.

    https://www.tindie.com/products/saim...-encoder-mini/


    I ordered 20 of the mini model to test, $2.28USD, turns out to $74.79CAD with normal shipping and exchange rate.

    Real interesting stuff. If everything is there to be open-source, I could even print my own.
    Last edited by Demon; - 15th January 2024 at 03:33.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,666


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    you sketch is incorrect , with button pressed v test == 0.45 v

    Name:  de.jpg
Views: 4066
Size:  259.4 KB
    Warning I'm not a teacher

Similar Threads

  1. USB interface
    By Frozen001 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th December 2011, 19:37
  2. Host for USB interface?
    By Carrasco in forum Off Topic
    Replies: 4
    Last Post: - 3rd August 2007, 23:59
  3. USB Interface using PIC
    By Tissy in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 22nd May 2006, 16:04
  4. USB interface from PIC16F877 to PC
    By headshouter in forum USB
    Replies: 0
    Last Post: - 26th February 2006, 04:58
  5. USB project
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 18th January 2005, 21:59

Members who have read this thread : 11

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts