1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Junebug Assembly Tips

Discussion in 'Microcontrollers' started by Krumlink, Nov 5, 2007.

  1. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    I know I should look this up first, but I am not motivated:

    can you run the Junebug as a debugger too?

    EDIT: Yes you can, Cool!

    I really like my inchworm+ it has been so good to me lately. No errors, no problems, perfect performance. Can the Junebug beat the all mighty Inchworm+? To set up the Junebug, all I have to do is to select PICKIT2?

    Bill, can I run the inchworm+ off a Unicorn kit?
     
    Last edited: Nov 15, 2007
  2. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    Yes, the Junebug works pretty much the same as the Inchworm+ but faster! The Inchworm+ can be mated to a Unicorn kit and would be about the same speed as Junebug. The only advantage is the Inchworm+ supports more high end PICs but that could change as the Junebug (PICkit 2) is catching up fast. Everytime Microchip releases a new MPLAB seems the PICkit 2 gets a firmware upgrade.

    Of course you can use the Junebug to play with the Unicorn but it's pretty advanced compared to the Junebugs 18F1320 tutor. I've seen the Unicorn turned into a simple GLCD scope.

    Having a spare PIC programmer is always handy.
     
  3. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    I am going to order the parts for the Junebug today. The C programming class was approved, so I was talking to him about getting some junebugs, once they become available. So far, my Junebug kit looks "interesting", as it has strange capacitors, a very oversized crystal, large 5mm LED's, very small buttons, thru hole individual resistors instead of the SIP resistors, and a diode sticking out of a solder hole way to far (the diode is a quarter of an inch in the air soldered :))

    Hey bill, if I send you a couple dollars in the mail (shipping), can I get a couple ferrite beads that you used? and for more money, can I get the inductor also?

    Thanks :D

    As for a kit idea for the junebug (don't know why you would need ANOTHER kit on it :D), you could just have the ICD cable connect to another board above or below it for something else.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA

    A strange thing to do with your Junebug would be programming its own 18F2550 for another one :p
     
  6. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    I was thinking of designing a board for programming a 18 Pin DIP, and I was wondering what are some features I should have on it? I want to fill this 5x2 or slightly small board up :D
     

    Attached Files:

  7. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    I just tried programming a 18F1320 with my Knight rider light (A lesson that I did myself from 3v0 :)) And it worked only with a LED on the MCLR line and a resistor and ground. Here is my knight rider light code :)

    It is in C for the 18F1320

    Make sure you have header files and linker files for it :)

    Code (text):
    #include <p18f1320.h>
    #include <delays.h>
    #include <stdio.h>
    #include <stdlib.h>

    #pragma config WDT = OFF
    #pragma config OSC = INTIO2
    #pragma config LVP = OFF
    #pragma config PWRT = ON


    // define TESTS
    #define byte unsigned char
    #define int8 unsigned char

    #define CMD   0x00
    #define DATA  0x01
    #define READ  0x01
    #define WRITE 0x00

    #define TRIS_ACT_LED       TRISBbits.TRISB2
    // TRISAbits.TRISA2
    #define ACT_LED            LATBbits.LATB2
    // LATAbits.LATA2  


    void delay_10us(unsigned char t);
    void delay_ms(long t);

    void delay_10us(byte t)
    {
       int i;
       for (i=0;i<t;i++)
          Delay10TCYx(5);
    }

    void delay_ms(long t)   // delays t millisecs
    {
       do
       {
         delay_10us(99);    // not 100 to compensate for overhead
       } while(--t);
    }

    void delay_us(long us)
    {
        long x = (us%1000)/10;
        delay_ms(us/1000);
        delay_10us(x);
    }    
       


    void main (void)
    {
      int flip = 0;
      long i,j;

      //
      // Set direction registers
      //
      //TRISA= 0x00;
      //TRISB= 0x00;
      TRIS_ACT_LED = 0; TRISA=0x00;  TRISB=0x00;

      //LAT0xA=0x00;
      //LATB=0x00;
     
     
      while (1)
      {
        //ACT_LED = 0;
        //LATA= 0x00;
        //The code below is what I did :) IT was really fun and easy once I learned HEX :D
        LATB= 0x01;
        delay_ms(1);
        //ACT_LED = 1;
        //LATA= 0xFF;
        LATB= 0x02;
        delay_ms(1);
        LATB= 0x04;
        delay_ms(1);
        LATB= 0x08;
        delay_ms(1);
        LATB= 0x010;
        //HEX was used here above and below :D
        delay_ms(1);
        LATB= 0x020;
        delay_ms(1);
        LATB= 0x10;
        delay_ms(1);
        LATB= 0x08;
        delay_ms(1);
        LATB= 0x04;
        delay_ms(1);
        LATB= 0x02;
        delay_ms(1);
        LATB= 0x01;
        delay_ms(1);
      }
    }
    You should be able to figure out what Ports I used :D
     
  8. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    The MCLR on the 18F1320 is an input only.
     
  9. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    LOL I have no idea why it flashes when I program code into it :D

    Even so, should I keep an LED on it? It appears to not affect performance at all.

    What else should I add to my board? I want to get it into design by tomorrow at least. Just a few more things I would like to add would be more Status LED's, and some other stuff that will be helpful while debugging and programming.
     
    Last edited: Nov 15, 2007
  10. kchriste

    kchriste New Member Forum Supporter

    Joined:
    Jul 23, 2006
    Messages:
    3,677
    Likes:
    47
    Location:
    Victoria BC, Canada
    Make it so there is a dip switch on PORTA (set as input). Make your program read the data on portA and move it back and forth on portB in knight rider fashion. Hint; what does the statement below do to the data in LATB?
    LATB <<= 1;
     
  11. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    After thinking of things to add, this is what I came up with :D

    I am using U2 (6 pin DIP as a Switch because of its template :)

    MCLR has a data processing LED on it :)
     

    Attached Files:

    • bleh.JPG
      bleh.JPG
      File size:
      101.3 KB
      Views:
      128
    Last edited: Nov 15, 2007
  12. kchriste

    kchriste New Member Forum Supporter

    Joined:
    Jul 23, 2006
    Messages:
    3,677
    Likes:
    47
    Location:
    Victoria BC, Canada
    Shouldn't the 3 switches in U2 be wired to 3 separate IO pins? :D
    8 pin DIP switches (4 switches) are more common also.
     
  13. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    Nope, I want them to be bussed together, just because I said, so ok?

    Oh wait, you got a problem with that buddy? Come on bring it on! Lets go! :p

    I found that 3 DIP Switches are cheaper than a 4 dip switch. It will still look good.
     
  14. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    If you want bussed switches then a DP3T switch will do, more expensive than a dip though but nice for switching the MCLR stuff / project stuff. Cheaper yet would be a far more common DPDT switch on just RB6, RB7. Avoid using MLCR for anything but a reset / ICD connection, if you're desperate for that extra I/O line then use a larger PIC.

    PS I've updated the Junebug Assembly Instructions on my site, some troubleshooting tips and corrected schematic & BOM plus the blinky LED program.

    Keep working with your programming Krumlink, you'll get the hang of it soon enough and then you can transplant a computerized brain into one of your robots.
     
  15. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    I am using the mclr pin as a reset, by shorting it to ground. It should be here by next week. Bill if you want these boards for something, PM me and we can set up a deal :)

    I will let you know how this one works.
     
  16. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    Well I was working on a side project that has a small breadboard, a 40pin PIC (a few choices), 20MHz crystal (deselectable), USB optional, keypad / LCD using up ports D & E
     
  17. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    Hey Bill. I had to laugh when I looked at the new pdf title on the first page. There is no such word as "labratory"! :D

    The word you're looking for is "laboratory".
    http://dictionary.reference.com/browse/laboratory

    You spelled it right just below the first picture, in the Introduction.
     
  18. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    Opps LOL. I'm still scratching my head on the introduction...

    Looking at Krumlinks code makes me want to learn C18. Can you combine #pragma statements?
     
    Last edited: Nov 16, 2007
  19. kchriste

    kchriste New Member Forum Supporter

    Joined:
    Jul 23, 2006
    Messages:
    3,677
    Likes:
    47
    Location:
    Victoria BC, Canada
    I'd just hate to see the little switches lost without a trace. ;) All bussed together like that. Without individual freedom. It's... It's just so ..... UnAmerican.... Your ARE American right? :D

    Yes, I've also been "inspired by Krumlink" and yes, you can combine them in a way:
    #pragma config WDT = OFF, OSC = INTIO67, LVP = OFF
     
  20. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    My Junebug is a dictatorship, so it has no freedom! :D
     
  21. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    I just noticed you're using a three position switch for reset. :( IMHO just don't add one, the Junebug / Inchworm can both control MCLR. And for standalone; the PIC will reset on powerup.
    If you're worried about lockup then learn about the WDT.

    Edit here's a simple single sided PCB layout, try to avoid right-angles on traces if you can and lay it out on a grid. This grid is 0.5"
    [​IMG]
     
    Last edited: Nov 16, 2007

Share This Page