# help with junebug

Status
Not open for further replies.

#### mrwhitee

##### New Member
I received the kit yesterday and assembled it lastnight. I am trying to flash the led's with this:

Code:
; *** Junebug 18F1320 LED sequencer demo ***
; Flashes LEDs1 thru 6 from left to right forever
; DIP Switch (SW6) must have TUTOR on (SW6-1,2,3) all other switches off
list p=18F1320
include <p18F1320.inc>
CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF
LED macro x,y ; MACRO LED <PORTA>, <TRISA>
movlw x
movwf LATA ; LATA = x
movlw y
movwf TRISA ; TRISA = y
call Delay ; call the Delay subroutine
endm ; end macro
Count equ 0 ; delay loop counter
org 0 ; reset vector
bsf ADCON1, 0 ; make RA0 digital
LED1 LED b'00000001', b'10111110' ; LED <PORTA>, <TRISA>
LED2 LED b'01000000', b'10111110' ; LED <PORTA>, <TRISA>
LED3 LED b'01000000', b'00111111' ; LED <PORTA>, <TRISA>
LED4 LED b'10000000', b'00111111' ; LED <PORTA>, <TRISA>
LED5 LED b'10000000', b'01111110' ; LED <PORTA>, <TRISA>
LED6 LED b'00000001', b'01111110' ; LED <PORTA>, <TRISA>
bra LED1 ; loop forever
Delay decfsz Count, f ; decrement Count and skip when zero
bra Delay ; not zero? repeat
return ; return
END
It seems like it programmed ok. No error messaged but only the green and yellow led light up. The 3rd big red led just barely makes a visible flicker.

I am not sure if something wrong with junebug or if I programmed it wrong with mplab.

I hit file and new and then copied above code and then clicked program to taget device. The small red led lights up for a second and then its over so I guess that part worked.

Please help. I have a volt meter which I know how to use and a oscilloscope phillips pm3365A which I dont know how to use yet but I have it set up.

#### blueroomelectronics

##### Well-Known Member
The red LED (Busy) should only flicker while the programmer is in use.
There is a run release button in MPLAB or turn DIP-1 off (this will disconnect VPP/MCLR from the programmer)

#### mrwhitee

##### New Member
The small red led only light up during programming. Its one of the 6 red led's that barely flicker. The other 5 do nothing.

#### 3v0

##### Coop Build Coordinator
Forum Supporter
That all sounds normal.

What Bill is saying is that you need to have the interface allow the program to run. Currently it is being held in the reset state.

I do not know if you are using MPLAB as a programmer or debugger, or the PICkit2 tool or maybe some other program. Regardless of which you are using you need to release the target from reset.

In MPLAB under programmer click "Release from reset"
If you are using the debugger rather then the programmer in MPLAB you need to click run.
If you are using PICkit2 software uncheck "hold device in reset"

They all do the same thing in that they allow the program to run.

#### mrwhitee

##### New Member
ok, In mplab I reinstalled the above code and clicked release from reset.

Now The green led is on.

and 1 of the 6 red led's is lit steady. No blinking though.

#### mrwhitee

##### New Member
I should mention the red led that is lit is not very bright.

#### be80be

##### Well-Known Member
The tutor is not programed . What your saying is you have holding it in your hand dip switch on the right led four to the left is barely flickering that' s what mine dose till I program it. If the led 4 is not fickering it's set to hold in reset. One more thing make sure you have Q4 installed right.

Last edited:

#### 3v0

##### Coop Build Coordinator
Forum Supporter
You program the target by doing PROGRAMMER>PROGRAM

In MPLAB. In the output window, tab PICkit2 you should see this when you program the target.

Code:
Programming Target (6/7/2009  2:07:49 PM)
PIC18F1320 found (Rev 0x7)
Erasing Target
Programming Program Memory (0x0 - 0x57)
Verifying Program Memory (0x0 - 0x57)
Programming Configuration Memory
Verifying Configuration Memory
[B]Setting MCLR Vdd[/B]
PICkit 2 Ready
It is the line "Setting MCLR Vdd" which allows the target processor (10 pin 18F1320) on the junebug to run.

Are you seeing anything different.

And while we are here the build output should look like
Code:
----------------------------------------------------------------------
Debug build of project C:\Users\webmaster\Desktop\blinkFolder\blinkTry.disposable_mcp' started.
Preprocessor symbol __DEBUG' is defined.
Sun Jun 07 14:16:59 2009
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Copyright (c) 2009 Microchip Technology Inc.
Errors    : 0

----------------------------------------------------------------------
Debug build of project C:\Users\webmaster\Desktop\blinkFolder\blinkTry.disposable_mcp' succeeded.
Preprocessor symbol __DEBUG' is defined.
Sun Jun 07 14:17:03 2009
----------------------------------------------------------------------
BUILD SUCCEEDED
But where I have "blinkTry" you will have whatever file name you used.

#### be80be

##### Well-Known Member
I don't use Mplab for pic18 much I all ways use the pickit2 software to program. But I
tried his code and it runs fine on my junebug and from what he has said so far I think he may have Q4 the wrong way. I may be wrong. But if he did that's why led3 is flickering. and the tutor will stay in reset

#### mrwhitee

##### New Member
its not hold in reset anymore because I Clicked release from reset but the Red led 4th from right is lit up at about half brightness. I believe q4 is installed correctly.

#### Attachments

• 380.8 KB Views: 83

#### mrwhitee

##### New Member
programmed like you said but with blinky.hex.

Initializing PICkit 2 version 0.0.3.63
Found PICkit 2 - Operating System Version 2.32.0
PICkit 2 Unit ID = OlHoss
Target power not detected - Powering from PICkit 2 ( 5.00V)
PIC18F1320 found (Rev 0x7)

Programming Target (6/7/2009 2:47:43 PM)
PIC18F1320 found (Rev 0x7)
Erasing Target
Programming Configuration Memory
Verifying Configuration Memory

Setting MCLR Vdd

Still the same results though

#### be80be

##### Well-Known Member
Try your hex with the pickit2 software

#### 3v0

##### Coop Build Coordinator
Forum Supporter
It looks like the code build correctly and programming worked.

Code:
Programming Configuration Memory
Verifying Configuration Memory
The output from programming should say
"Verifying Program Memory (0x0 - 0x57)"

If the chip is successfully programmed you can turn of dip switch positions 1-3 and the lights should cycle. That is not normally how we do a release from reset but it is foolproof.

#### mrwhitee

##### New Member
ok used pickit2 and now all leds are flashing from left to right. The green and yellow are still it. Is this correct?

#### mrwhitee

##### New Member
meant to say the green and yellow are still lit not it.

#### mrwhitee

##### New Member
3vo. I must have been doing something wrong in mplab. I didnt build anything I dont think. I opened up the blinky hex file and clicked programmer program and the output I showed was all there was.

#### 3v0

##### Coop Build Coordinator
Forum Supporter
ok used pickit2 and now all leds are flashing from left to right. The green and yellow are still it. Is this correct?
yes it is.

green = power
yellow = USB data connection
red = busy

#### mrwhitee

##### New Member
Cool. Now I know my board is working and I just need to learn how to work it. Thanks be80be and 3v0 and everybody else for helping.

#### 3v0

##### Coop Build Coordinator
Forum Supporter
I am not sure what the problem is/was in MPLAB. But in general MPLAB is where you want to do development. I am thinking that the chip was not programed with the hex file (or the right one) while in MPLAB.

In both MPLAB and PICkit2 you have to import the hex file prior to programming it. Perhaps you did not do so and programmed as zeros.

#### mrwhitee

##### New Member
im going to try again with mplab. I need to figure it out.

Status
Not open for further replies.