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

using junebug con2 port

Status
Not open for further replies.

MrDEB

Well-Known Member
presently have all the dip switches OFF
using swordfish compiler, I press F10 to compile/program
then unplug the ribbon cable, connect a battery to the target circuit to see results.
how can I see my results without disconnecting con2 or can I just leave the battery connected?
OR can one program using the con3 port and see results.
the assembly how to on the junebug is very brief but its a great tool.
the dip switch diagram is really brief for a beginner.
If I knew all the whats and hows I would love to rewrite w/ permission.
 

3v0

Coop Build Coordinator
Forum Supporter
When you have programed any chip using the programmer (not debugger) you can cause it to run by having the programmer release the MCLR line which then goes to 5V. This will allow the chip to run from reset.

EDIT: The following applies to MPLAB and MrDeb is not using it.
To do this from the main menu bar click PROGRAMMER then RELEASE FROM RESET.
 

blueroomelectronics

Well-Known Member
Swordfish uses the PK2CMD.EXE program to send the file to the Junebug, I recall one of the command switches will run target after a successful program. I'm pretty sure it's enabled in the setup in the Junebug manual.

You can also run PK2CMD.EXE /? from the command shell (RUN/CMD) to see the options.
 

be80be

Well-Known Member
MrDeb Are you wanting to power target so you don't have to unhook it and power up
to run your code. The easy way is to open the pickit2 build and load in swordfish and click the vdd like in the pic. Just make sure you turn the power back off when you load a new code or it will not let you program the chip with swordfish.
 

Attachments

Last edited:

MrDEB

Well-Known Member
will try as per be80be

I am using junebug to program but will try the Vdd box in pickit2
just need to compile then save the hex file for use in the pickit2 program.
 

be80be

Well-Known Member
just need to compile then save the hex file for use in the pickit2 program.
NO NO NO NO You just use it to turn on the power that's it use swordfish to load your hex and the pickit software to turn on the power it's smiple
 

blueroomelectronics

Well-Known Member
There is no "release from reset" in the swordfish IDE ?
No as it's designed for external programmers.

You could use the PK2 2.61 software to reprogram on .hex change, and then you have reset control.

OR

leave DIP1-1 on and you can reset your target with the reset button on the Junebug. This will add the VPP pullup too.
 

3v0

Coop Build Coordinator
Forum Supporter
Bill is the man with the answer here.
In Swordfish BASIC and PICkit 2 integration (one button compile & program) Bill described how to get the pickit2/junebug to work with the swordfish IDE.

And in this thread he is telling you there should be a command line switch for "pk2cmd.exe" to cause MCLR to be released from reset. Let the program run.

This is I get from stumbling around with tools I do not use.
 

3v0

Coop Build Coordinator
Forum Supporter
That's not what he is doing he is programming a chip on the bread board and wanting to power it with the junebug and run the code Iscp like the pickit 2 dos it
Except for the position of the 3 dip switches it does not matter if the chip is on the Junebug or on an a bread board.

From the PIC2CMD help file
Code:
Using -T and -R options to run after programming:

1) MCU is externally powered, and MCLR pin is configured as IO.
      Switches needed to run after programming: NONE
2) MCU is externally powered, and MCLR pin is configured as MCLR
      Switches needed to run after programming: -R
3) MCU needs to be powered from PICkit 2, MCLR configured as IO.
      Switches needed to run after programming : -T
4) MCU needs to be powered from PICkit 2, MCLR configured as MCLR.
      Switches needed to run after programming: -R -T
 

be80be

Well-Known Member
I hate to say it but that don't work to power target. What bill posted is the same command I have been using when I started using swordfish. It will not power up the target. It may work if you have power on the target I always use the usb for power it there LOL
 
Last edited:

be80be

Well-Known Member
this is what you would want to use
/PPIC$target-device$ /F$long-hex-filename$ /M /R /H2 /T

Code:
C:\PK2CMDv1-20>dir
 Volume in drive C has no label.
 Volume Serial Number is B0BD-8280

 Directory of C:\PK2CMDv1-20

03/30/2009  09:42 PM    <DIR>          .
03/30/2009  09:42 PM    <DIR>          ..
03/30/2009  09:42 PM           151,552 pk2cmd.exe
03/30/2009  09:42 PM           156,449 PK2DeviceFile.dat
03/30/2009  09:42 PM            93,031 PK2V023200.hex
03/30/2009  09:42 PM            43,073 Readme For PK2CMD.txt
               4 File(s)        444,105 bytes
               2 Dir(s)  18,831,011,840 bytes free

C:\PK2CMDv1-20>pk2cmd.exe
                        PICkit 2 COMMAND LINE HELP
Options              Description                              Default
----------------------------------------------------------------------------
A<value>             Set Vdd voltage                          Device Specific
B<path>              Specify the path to PK2DeviceFile.dat    Searches PATH
                                                              and calling dir
C                    Blank Check Device                       No Blank Check
D<file>              OS Download                              None
E                    Erase Flash Device                       Do Not Erase
F<file>              Hex File Selection                       None
G<Type><range/path>  Read functions                           None
                     Type F: = read into hex file,
                             path = full file path,
                             range is not used
                     Types P,E,I,C: = ouput read of Program,
                             EEPROM, ID and/or Configuration
                             Memory to the screen. P and E
                             must be followed by an address
                             range in the form of x-y where
                             x is the start address and y is
                             the end address both in hex,
                             path is not used
                             (Serial EEPROM memory is 'P')
H<value>             Delay before Exit                        Exit immediately
                         K = Wait on keypress before exit
                         1 to 9 = Wait <value> seconds
                                  before exit
I                    Display Device ID & silicon revision     Do Not Display
J<newlines>          Display operation percent complete       Rotating slash
                         N = Each update on newline
K                    Display Hex File Checksum                Do Not Display
L<rate>              Set programming speed                    Fastest
                     <rate> is a value of 1-16, with 1 being
                     the fastest.
M<memory region>     Program Device                           Do Not Program
                     memory regions:
                         P = Program memory
                         E = EEPROM
                         I = ID memory
                         C = Configuration memory
                         If no region is entered, the entire
                         device will be erased & programmed.
                         If a region is entered, no erase
                         is performed and only the given
                         region is programmed.
                         All programmed regions are verified.
                                    (serial EEPROM memory is 'P')
N<string>            Assign Unit ID string to first found     None
                     PICkit 2 unit.  String is limited to 14
                     characters maximum.  May not be used
                     with other options.
                     Example: -NLab1B
P<part>              Part Selection. Example: -PPIC16f887     (Required)
P                    Auto-Detect in all detectable families
PF                   List auto-detectable part families
PF<id>               Auto-Detect only within the given part
                     family, using the ID listed with -PF
                     Example: -PF2
Q                    Disable PE for PIC24/dsPIC33 devices     Use PE
R                    Release /MCLR after operations           Assert /MCLR
S<string/#>          Use the PICkit 2 with the given Unit ID  First found unit
                     string.  Useful when multiple PICkit 2
                     units are connected.
                     Example: -SLab1B
                     If no <string> is entered, then the
                     Unit IDs of all connected units will be
                     displayed.  In this case, all other
                     options are ignored. -S# will list units
                     with their firmware versions.
                     See help -s? for more info.
T                    Power Target after operations            Vdd off
U<value>             Program OSCCAL memory, where:            Do Not Program
                      <value> is a hexadecimal number
                      representing the OSCCAL value to be
                      programmed. This may only be used in
                      conjunction with a programming
                      operation.
V<value>             Vpp override                             Device Specific
W                    Externally power target                  Power from Pk2
X                    Use VPP first Program Entry Method       VDD first
Y<memory region>     Verify Device                            Do Not Verify
                         P = Program memory
                         E = EEPROM
                         I = ID memory
                         C = Configuration memory
                         If no region is entered, the entire
                         device will be verified.
                         (Serial EEPROM memory is 'P')
Z                    Preserve EEData on Program               Do Not Preserve
?                    Help Screen                              Not Shown

     Each option must be immediately preceeded by a switch, Which can
     be either a dash <-> or a slash </> and options must be separated
     by a single space.

     Example:   PK2CMD /PPIC16F887 /Fc:\mycode /M
                               or
                PK2CMD -PPIC16F887 -Fc:\mycode -M

     Any option immediately followed by a question mark will invoke
     a more detailed description of how to use that option.

     Commands and their parameters are not case sensitive. Commands will
     be processed according to command order of precedence, not the order
     in which they appear on the command line.
        Precedence:
                -?      (first)
                -B
                -S
                -D
                -N
                -P
                -A -F -J -L -Q -V -W -X -Z
                -C
                -U
                -E
                -M
                -Y
                -G
                -I -K
                -R -T
                -H      (last)

     The program will return an exit code upon completion which will
     indicate either successful completion, or describe the reason for
     failure. To view the list of exit codes and their descriptions,
     type -?E on the command line.

     type -?V on the command line for version information.

     type -?L on the command line for license information.

     type -?P on the command line for a listing of supported devices.
     type -?P<string> to search for and display a list of supported devices
                      beginning with <string>.

     Special thanks to the following individuals for their critical
     contributions to the development of this software:
                Jeff Post, Xiaofan Chen, and Shigenobu Kimura

Operation Succeeded

C:\PK2CMDv1-20>
 
Last edited:

blueroomelectronics

Well-Known Member
Hmm then jumper +5V to U5V on the top connector, this will bypass the VDD switch. I'll add that switch into the Junebug manual thanks be80be
 
Last edited:

be80be

Well-Known Member
That's the only reason I figured I had a chance at programming I do no how to write shell scripts been bashing for years and msdos before that
That works like a charm
Code:
/PPIC$target-device$ /F$long-hex-filename$ /M /R /H2 /T
 

MrDEB

Well-Known Member
WHOOO now I is lost!

I tried hitting F10 in swordfish but first , using pickit2 prg I erase the chip.
PROCDURE seems to work
erase chip using pk2
compile/prg using swordfish(F10)
back tp pk2, click on the Vdd box and target pic stars doing its thing
seems safe enought but isthis the best way??
you guys are talking adding a Vdd switch etc??
I just want an easy way to hit F10 and run the target PIC
so far it works with blinking an LED
just can't figure out WHY the timer code I posted last week worked and now it dosn't.
I have been testing by F10, unhooking the con2, connecting a battery
IT WORKED LAST WEEK??
losing hair in Salmon, Idaho searching for fix or shorter code
 

3v0

Coop Build Coordinator
Forum Supporter
Hmm then jumper +5V to U5V on the top connector, this will bypass the VDD switch. I'll add that switch into the Junebug manual thanks be80be
Why is the jumper needed ?

4) MCU needs to be powered from PICkit 2, MCLR configured as MCLR. Switches needed to run after programming: -R -T

It looks like the R and T switches need to be used with a 2nd run of pk2cmd.exe. Maybe someone can give it a try.

I am not sure if you can ask swordfish to run 2 commands. Maybe call a script/batch file to do it.
 

be80be

Well-Known Member
/PPIC$target-device$ This switch sets target
/F$long-hex-filename$ This switch sets file
/M This switch programs the pic
/R This switch Release /MCLR
/H2 This switch delays 2 sec
/T This switch powers target

This is what you want swordfish to run for the command of the pickit2 or junebug or any clone like the pickit2


Code:
/PPIC$target-device$ /F$long-hex-filename$ /M /R /H2 /T
You put that command right here and then you can hit f11 to compile and program and then it will power up the target
 

Attachments

Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top