PIC USB HID breakout board - Page 4
+ Reply to Thread
Page 4 of 4 FirstFirst 1234
Results 121 to 143 of 143
  1. #121
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Quote Originally Posted by towlerg View Post
    Sorry, that question was for amgen
    George, are you looking to get into doing some projects with wifi?

  2. #122

    Default Re: PIC USB HID breakout board

    No I don't think so, I just hoped that I could point amgen toward an easier enrty into the joys of USB custom/vendor/whatever.
    George

  3. #123
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Ok almost done I think..... Code is working good with a debounce/timeout now using interrupt when sensing proximity. Instead of adding in all kind of code to check and give the user a range for sensing I was thinking of adding in a bank of jumpers so if jumped 1 to 5 1=0"-12", 2= 12"-24", 3=24"-36", 4=26"-48", 5=48"-60" then no jumper >60. I might do a 6th jumper for the time jumped=1.39 second (I'll tell them 1.5) then not jumped=2.78 (I tell them 3) second. Anyway my question this time is I would plan on making all of those pins input. I can't recall I was planning on checking if the pin is high it is jumped so would it be ok to leave those all floating or best to pulldown if I configure them all as input.
    Thanks
    David

  4. #124

    Default Re: PIC USB HID breakout board

    I'm not sure if this is what your asking but I'd put a high value pullup (10k +) directly to the pin and gnd on the other side of the jumper - so jumper out = pulled up, jumper in = gnd. Do you have enough spare pins for one per jumper? Never a good idea to leave inputs floating.
    George

  5. #125

    Default Re: PIC USB HID breakout board

    If you put your jumpers on PORTB then you can use the programmable pullups on those pins, so all you need is a jumper to GND.
    That gives you up to eight jumpers (or just use a PCB DIP switch) w/out having to add anything else.

  6. #126

    Default Re: PIC USB HID breakout board

    Now why didn't I think of that, I quess I started typing without engaging brain.
    George

  7. #127
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Quote Originally Posted by tumbleweed View Post
    If you put your jumpers on PORTB then you can use the programmable pullups on those pins, so all you need is a jumper to GND.
    That gives you up to eight jumpers (or just use a PCB DIP switch) w/out having to add anything else.
    Tumbleweed perfect I could not remember which was the best way to check for jumper whether high or low what would put the least amount of strain on the power supply while the pic is basically sitting there. it's been years since I worked on any pic projects but it's coming back to me little by little.

    George, Oh yeah more than enough pins, to many actually, I like a smaller board that's why I was considering the 16F ones. Right now I am just using 2 one for the analog in from the sensor and another to drive an LED so I can visually see when the sensor picks up a person.

    Thanks guys.
    David

  8. #128

    Default Re: PIC USB HID breakout board

    As I say, If you enable the internal portb pullups and have your jumper/switch either open or to GND then the input will default to logic '1' since it's pulled high.

    The internal pullups are low-level current sources with a range of 25uA-300uA per pin (typ ~130uA). If you enable all eight of them and have them connected to GND, then that's about 1mA typ. If you're really concerned about that you could always enable the pullups, read the port, and then set them all to output low after you read it.

    I'm with George on preferring the 18F25K50 over the 16F. The 16F parts have gotten better, but the 18F tend to be nicer parts IMHO.
    Just my preference, but I like to use the largest memory part I can get. That way I know I'll never be fighting for resources.

    If you're building this by hand the 28-pin SOIC package isn't too bad size-wise and it's still something pretty easy to solder. I use the QFN packages which are really small, but I wouldn't trust my soldering skills with one of those. I'm a wimp.

  9. #129
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    tumbleweed, I would only be looking to have one of 5 pins pulled to ground at any one time so I don't think it is going to be a big concern. I did get the SOIC for the 18F it's not all that big. I did want to try to get the 16F working just to see if I can work my way through it. My first attempt after I thought I had everything configured correctly to just do USB working as HID keyboard resulted in some errors being generated when I complied it. For now I am going with the 18F soic package to put together a prototype but planned on trying to get the 16F working if I can get past the compiler errors.
    David

  10. #130
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Hi would one of you mind checking the datasheet make sure I read this correctly to enable the RB0 through RB5 as input and enable the week pullups.
    I think I interpreted this correctly

    Code:
        TRISA=%00001000
        TRISB=%00011111
        TRISC=%00000000
        WPUB=%00011111
        INTCON2.7=1
    http://ww1.microchip.com/downloads/e.../30000684B.pdf of course I am working with the 18F25K50
    Thanks
    David

  11. #131

    Default Re: PIC USB HID breakout board

    The RBPU bit (INTCON2.7) is low-active, so 0=pullups enabled, 1=pullups disabled

  12. #132
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Quote Originally Posted by tumbleweed View Post
    The RBPU bit (INTCON2.7) is low-active, so 0=pullups enabled, 1=pullups disabled
    Thanks let me review that again I must have misread that..... I see it now on page 115 thanks
    Last edited by DavyJones; - 13th December 2018 at 23:16.

  13. #133

    Default Re: PIC USB HID breakout board

    Also, most of the PORTB pins are dual analog/digital pins. You have to set them to digital mode otherwise they always read '0'.
    Either set ANSELB bits = 0 for the ones you want to be digital, or set config bit PBADEN = 0 to have them default to digital mode at poweron.

  14. #134
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Quote Originally Posted by tumbleweed View Post
    Also, most of the PORTB pins are dual analog/digital pins. You have to set them to digital mode otherwise they always read '0'.
    Either set ANSELB bits = 0 for the ones you want to be digital, or set config bit PBADEN = 0 to have them default to digital mode at poweron.
    Aaaahhh ok I see that now on page 133 for PBADEN (reset, power on) and notes for PORTB on page 148 for ANSELB
    I'm skipping over some reading and that's not good I need to review closer, I'd print the data sheets out if I could. Thanks for pointing that out to me. Slowly but surely I'm getting used to reading the data sheets again.
    I've added the jumpers to my schematic I should be sending out soon for the prototype boards to be manufactured.
    Last edited by DavyJones; - 14th December 2018 at 11:12.

  15. #135
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Ok so I have portb I think configured correctly where RB0 through RB6 are configured as digital for use with my jumpers to control the distance and timing. I will read low if the jumper is connected and set up things internally accordingly.

    So with that I have RA3 configured as analog input to read the value from the sonar sensor. All the other RA? are configured as output. As well as all of portc being set as output. One thing I read with regards to unused IO that I posted a little earlier is this is the proper thing to do configure them as output alternatively you could also attach a 1k to 10k resistor and drive them low. I don't get why you would do the latter anyway.... should I configure those as digital or is it good enough to just set up through TRIS? to be output. Also do they need to really be all taken "LOW" with the code? This leads me to think if they should be driven low then they should be configured as digital as well.
    thoughts
    David

  16. #136

    Default Re: PIC USB HID breakout board

    Once you set the pin to output, the digital/analog mode setting doesn't really matter.
    You can output a 1 or 0 with the pin still in analog mode. All that bit does is turn off the digital input buffer so that the digital input doesn't see a floating condition.

    As far as setting the unused pins to output high vs output low, I can't think of a good reason one way or the other. I'd go with low so that if you happen to GND the pin it won't damage anything.

  17. #137
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Thanks...I was just going off the data sheet that suggests setting the pins as output and bringing them all low.

  18. #138
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    ok I think the last question before I send off to manufacture a couple prototypes. I can't seem to see clearly in the data sheet. Normally I would connect the paired VSS and VDD with a .1uf across them. There is an extra VSS (pin 8) which though it does not appear paired this too should get the .1uf paired to VDD in general. Sound right?

  19. #139
    Join Date
    Sep 2009
    Posts
    733

    Default Re: PIC USB HID breakout board

    No need for cap there, but it won't hurt to put it.
    You need to make ground impedance as low as possible, and high speed current loop smallest possible. Also keep d+,d-, osc trace short.
    It would be helpful to see board to give specific advice.

  20. #140
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Hey guys I am still here just been very busy with my day job. pedja, thanks for offering to take a look. I need to get a copy of the schematic over from the other pc which I will try to do today. I am not using an external oscillator for this project no need to.
    for my final board I was planning on adding a copper pour and connecting to ground. All of the traces to the caps are extremely short as I have placed the needed caps virtually right beside the pins they connect to.
    regards
    David

  21. #141
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    Damn I should not have taken so many days off from my project. I did some research over my break and I wanted to revisit the logic to try and send data back to the pic via dousbin. I read over the thread again and I am a little confused. with the dousbin should it be possible that if I type something on the keyboard itself I can read that (pick it up) in the dousbin routine?

    Code:
    DoUSBIn:
        USBBufferCount = USBBufferSizeRX ' RX buffer size
        USBService ' keep connection alive
        USBIn 1, USBBufferIn, USBBufferCount, DoUSBIn   ' read data, if available                 
    USBexit:
    Doing some research I found that it may be possible with IE to utilize some VBSCRIPT (active x'ing) in my HTML page and actually simulate entering data on the keyboard. Of course this will not work in Chrome but Chrome does have some other provisions that may work as well and it's easy enough to determine the browser that is being used to determine which routine to use to accomplish sending data to the keyboard buffer. If I can send back a keyword this would make things so much simpler. To explain why this is much simpler/cleaner. Right now my device sends "wakeup" as soon as something is in range. This causes problems because the word "wakeup" starts showing up all over the place as soon as I plug the device in wherever my cursor happens to be before I launch my web page and get things focused on it. So all of the sudden "wakeup" appears in whatever I have open at the time including the browser itself, if my cursor happens to be in the url field as I am trying to type "http://123.123.123.123/kiosk.html" all of the sudden in the middle i'll get "http://123.12wakeup" then of course since I am sending a carriage return the browser immediately tries to navigate to that. Ideally I want to plug the device into the USB and have it do nothing until it would read "listen" or some other keyword then at that point it would actually start to send "wakeup" back to the web page.

    I'm a bit stuck if I call dousbin in my main routine that I am looping through reading the adval from the sonar sensor it gets stuck it never seems to read anything. Thoughts?

    Thanks
    David

  22. #142

    Default Re: PIC USB HID breakout board

    We seem to be going around in circles.

    I did some research over my break and I wanted to revisit the logic to try and send data back to the pic via dousbin
    I thought that the javascript running on the PC is input-only, so you can't send data to the pic via usb 'doanything'.

    The HID keyboard running on the pic is meant to have the "keyboard connected" to the pic, and the PC uses that interface to connect to the keyboard via USB (the pic in this case). Having the PC put things into its keyboard buffer doesn't send anything to the pic, it just makes the PC think it got input data from the USB.

  23. #143
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    158

    Default Re: PIC USB HID breakout board

    tumbleweed..... I was just doing some more research on that javascript limitation over the holiday and it is true that javascript in this case is a one way street. There is no way with javascript to do anything like tell it to press a key that would in a sense be the same as pressing a key on the keyboard that the PC would detect. however internet explorer can also run vbscript in which case there is a way to send keys through vbscript like I can tell it to press the caps lock or any other key.

    I don't know why I never pictured in my head the way you described the PIC but now that you have described it that way it makes perfect sense to me. I just kept picturing it more of a serial bi directional device but now I get it.

    however I can use vbscript as I mentioned and can tell it to turn the caps lock on, scroll lock, num lock on programmatically and that will turn the LED's on, on the keyboard and effectively toggle those on and off. I was thinking if I can do that with vbscript then I may be able to use a combination of those keys to accomplish what I am trying to get to which is a state in which the PIC can decide when to send the "wakeup" string.
    For instance if caps lock+scroll lock+num lock are on then the PIC would start to send "wakeup" when triggered by the sonar. So once my slide show starts run the vb script to turn those 3 keys on. I would turn them back off again once the slideshow stopped which is essentially at the same time I would send "wakeup"

Similar Threads

  1. USB hid maker help please.
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd April 2013, 14:49
  2. HID USB on 18F87J50
    By pedja089 in forum USB
    Replies: 56
    Last Post: - 25th August 2011, 09:24
  3. USB HID and RealBasic
    By PJALM in forum USB
    Replies: 5
    Last Post: - 6th July 2011, 07:49
  4. USB HID Problem
    By Gitchie in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th January 2011, 15:15
  5. Usb hid
    By yatyas72 in forum USB
    Replies: 5
    Last Post: - 3rd December 2010, 15:45

Members who have read this thread : 25

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

Tags for this Thread

Posting Permissions

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