Continue to Site

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.

  • 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.

Junebug Assembly Tips

Status
Not open for further replies.
5.07 volts with both PICs removed. Is that normal?

edit: I just reinserted the PICs, and I noticed I have the dip switches in backwards compared to the picture in the manual. I set them up like the picture and re-checked voltage and got 5.04v . I'm assuming everything is good now?
 
Last edited:
thekyguy11 said:
5.07 volts with both PICs removed. Is that normal?

edit: I just reinserted the PICs, and I noticed I have the dip switches in backwards compared to the picture in the manual. I set them up like the picture and re-checked voltage and got 5.04v . I'm assuming everything is good now?
Just get on with it and program a PIC! :p Then you'll know. Measuring it for a day will get you nowhere. :D
 
yea, they were in correctly..

Anyways, I was able to get the demo where LED 4 flashes, and then I got the chasing LED to work. Everything was great...But, when I tried to change the code for the chasing LED one, it looked kinda goofy, so I tried to re-load the blinky.asm that you provided. For some reason it acts like LED 2 and LED 5 are backwards. When I erase using the pickit2 software and it sits idle, LED 3 kinda dimly flickers on and off like one of those fake candle bulbs you see at christmas time. I tried deleting everything I created off the computer and starting from scratch with fresh code, but it still won't "chase" properly.

I wouldn't really care, but I feel like it could be a hardware issue.
 
It sounds like it's fine. LED3 will flicker on a blank 18F1320 because the 18F1320 thinks it's an oscillator and an LED can act as a cap, moving your hand near it or touching it will stop it from happening.
Charlieplexing LEDs can be a little daunting.
Here's the Blink program Swordfish BASIC and the module for the Junebugs LEDs. Swordfish .hex files can be loaded using the PICkit2 standalone software or programmed directly using PK2CMD.EXE

Edit rewritten module using High(x) and Low(x) commands.

Blinky Swordfish BASIC SE for the Junebug
Code:
{
*****************************************************************************
*  Name    : BLINK_1.BAS                                                   *
*  Author  : William Richardson                                             *
*  Notice  : Copyright (c) 2008 blueroomelectronics                         *
*          : All Rights Reserved                                            *
*  Date    : 1/7/2008                                                       *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
Device = 18F1320
Clock = 4               // 4MHz clock
Include "junebug.bas"
Dim Count As Byte
While True
    For Count = 0 To 6
        LED(Count)
    DelayMS(300)        // delay in 1000s of a second
    Next
Wend        // repeat forever
End
And the module (just save it like any other program)
Code:
{
*****************************************************************************
*  Name    : JUNEBUG.BAS                                                    *
*  Author  : William Richardson                                             *
*  Notice  : Copyright (c) 2008 blueroomelectronics                         *
*          : All Rights Reserved                                            *
*  Date    : 2/1/2008                                                       *
*  Version : 0.91beta                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}

Module Junebug
Device  = 18F1320
Public Sub LED(x As Byte)
  Select x
    Case 1      // LED 1
    TRISA.0 = 0
    TRISA.6 = 0
    TRISA.7 = 1
    High(PORTA.0)
    Low (PORTA.6) 
    Case 2      // LED 2
    TRISA.0 = 0
    TRISA.6 = 0
    TRISA.7 = 1
    Low (PORTA.0)
    High(PORTA.6)      
    Case 3      // LED 3
    TRISA.0 = 1
    TRISA.6 = 0
    TRISA.7 = 0
    High(PORTA.6)
    Low (PORTA.7)      
    Case 4      // LED 4
    TRISA.0 = 1
    TRISA.6 = 0
    TRISA.7 = 0
    Low (PORTA.6)
    High(PORTA.7)      
    Case 5      // LED 5
    TRISA.0 = 0
    TRISA.6 = 1
    TRISA.7 = 0
    Low (PORTA.0)
    High(PORTA.7)      
    Case 6      // LED 6
    TRISA.0 = 0
    TRISA.6 = 1
    TRISA.7 = 0
    High(PORTA.0)
    Low (PORTA.7)      
  Else          // All LEDs Off 
    TRISA.0 = 1
    TRISA.6 = 1
    TRISA.7 = 1

  End Select
End Sub
Config OSC = INTIO2, WDT = OFF, LVP = OFF
ADCON1  = %11110101
OSCCON = $62            // 4 MHz clock
 
Last edited:
I love how quickly you reply!

It took a minute, but I figured out how to get that to work using swordfish. Much easier than MPLAB in my opinion. But if they are supposed to be chasing in order, they aren't. It goes... 1-3 and 5 together-3-4-5-6, 2 never even lights. What am I doing wrong?
 
Does the assembly version in the manual work fine for you?
Try to turn the LEDs on one at a time, I'll repost with a modified Junebug module. Swordfish is very nice, I just started playing with their new LCD plugin.
**broken link removed**
 
Last edited:
It did work, but only the first time. For some reason, it seems like ever since I changed the assembly code, it wont work right. I was going to ask how to turn them on one at a time, but you beat me to it. Seems like a good troubleshooting technique.
 
Hmm sounds like a config problem, try adding
Code:
Config OSC = INTIO2, WDT = OFF, LVP = OFF
The MPASM and C18 allow for debugging, you can even toggle the pins in a watch window. So try watching TRISA & PORTA with the debugger running and the .asm blinky. You can single step, set breakpoints and toggle the I/O directly. Makes coding for PICs very easy to understand.
Swordfish does not have debug support but is otherwise excellent and I even like its IDE

Edit refresh your browser, I've rewritten the Junebug module with the High & Low pin commands.
 
Last edited:
I was able to isolate LED1 by changing the module on swordfish. When I did the same to isolate LED2, it again lights 3 and 5 instead of 2.
 
These will determine the I/O on powerup, if they're not there the I/O could get wonky on the Junebugs Tutor. Try out the debugger and post your code.

Code:
CONFIG OSC = INTIO2
ADCON1 = %11110101
 
I changed the module in swordfish like this...

{
*****************************************************************************
* Name : JUNEBUG.BAS *
* Author : William Richardson *
* Notice : Copyright (c) 2008 blueroomelectronics *
* : All Rights Reserved *
* Date : 2/1/2008 *
* Version : 0.91beta *
* Notes : *
* : *
*****************************************************************************
}

Module Junebug
Device = 18F1320
Public Sub LED(x As Byte)
Select x
Case 2 // LED 2
TRISA.0 = 0
TRISA.6 = 0
TRISA.7 = 1
Low (PORTA.0)
High(PORTA.6)

Else // All LEDs Off
TRISA.0 = 1
TRISA.6 = 1
TRISA.7 = 1

End Select
End Sub
Config OSC = INTIO2, WDT = OFF, LVP = OFF
ADCON1 = %11110101
OSCCON = $62 // 4 MHz clock


to isolate LED2. With this code, instead of LED2 blinking, 3 and 5 do. I tried isolating it with MPLAB and was able to do so with the breakpoints, but I can't get any changes to work...

And I can't seem to get that last config code that you suggested to work without getting an error.
 
Ahh got it, LED 2 is dead or not connected or in backwards, this would allow current to flow through LEDs 3&5 when LED2 is supposed to be on. I take it it's never lit up. If it has then it sounds like it's in backwards.
 
ah ha! I knew it wasn't code related, LOL. This may be easy stuff for you, but the fact that I was able to do what I did makes me feel like a genius! 'twas such a great learning process!

I'll test the LED and let you know what I find. It's definitely not in backwards, unless they flattened the wrong side.
 
Just email me with your mailing address I'll put one in the post. They are 5mm Red around 800mcd.
Hard to burn out an LED but a dud can sneak in there.
The radio shack one will work fine.
 
Last edited:
Junebug from Hyderabad, India-- is HERE. I did make some changes in the 10pin connector type. it is a right angle type. Ipropose to put a pindetails as a sticker on top of it.

Thanks to Bill who readily agreed to send ,not only bare board, but the crtical resistor packs also, across the Globe.
 
Last edited:
thekyguy11 said:
ah ha! I knew it wasn't code related, LOL. This may be easy stuff for you, but the fact that I was able to do what I did makes me feel like a genius! 'twas such a great learning process!

I'll test the LED and let you know what I find. It's definitely not in backwards, unless they flattened the wrong side.
OH! it is from an international supplier may be from China. I too got 7 atleast in a batch of 25.Some were showing break even-- I don't know whether to to call them Dumpers or call the landing country unlucky.
Rather unfortunate.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top