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.

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.
 
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)
 
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.
 
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.
 
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.
 
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:
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.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p18F1320 "blinkTry.asm" /l"blinkTry.lst" /e"blinkTry.err" /d__DEBUG=1
Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p18F1320 "blinkTry.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"blinkTry.cof" /M"blinkTry.map" /W /x
MPLINK 4.30, Linker
Copyright (c) 2009 Microchip Technology Inc.
Errors    : 0

Loaded C:\Users\webmaster\Desktop\blinkFolder\blinkTry.cof.
----------------------------------------------------------------------
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.
 
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
 
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

  • 2009-06-07 14.25.35.jpg
    2009-06-07 14.25.35.jpg
    380.8 KB · Views: 186
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)
PICkit 2 Ready

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

Setting MCLR Vdd

Still the same results though
 
It looks like the code build correctly and programming worked.

but yours had

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.
 
ok used pickit2 and now all leds are flashing from left to right. The green and yellow are still it. Is this correct?
 
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.
 
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.
 
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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top