PIC USB HID breakout board - Page 4


+ Reply to Thread
Page 4 of 4 FirstFirst 1234
Results 121 to 137 of 137
  1. #121
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    154

    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
    154

    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
    154

    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
    154

    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
    154

    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
    154

    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; Yesterday at 00: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
    154

    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; Yesterday at 12:12.

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

    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
    154

    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.

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, 16:15
  5. Usb hid
    By yatyas72 in forum USB
    Replies: 5
    Last Post: - 3rd December 2010, 16:45

Members who have read this thread : 24

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