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 Name & Calibration program (BETA)

Status
Not open for further replies.

blueroomelectronics

Well-Known Member
This program is designed to set the VDD calibration data (it's erased when you name the Junebug with the PICkit2 software)
A calibrated Junebug can program 3.3V PICs that have 5V tolerant I/O like the 18F67J60 (target must have its own 3.3V power supply)
You use the Junebugs bootloader feature to install the hex file this program creates (hold down the button near pin1 on the 18F2550) before plugging in the USB cable.
After it runs (about 2 sec) unplug the Junebug, close PICkit2 2.50 and hold down the bootloader button and plug in the USB cable. Reload PICkit2 2.50
and install the PICkit2 OS.
This program is in testing at this point, do not change anything unless you understand how the PICkit2 bootloader function.
Code:
; Change only the data in the two following defines
#define MyJune  "Super Junebug" ; Junebug name <= 15 bytes
#define VCal    0xFA81          ; 4.2V Calibration 0x02
    list     p=18F2550
    include <p18F2550.inc>
        org    0x2000          ; Junebug bootloader vector
Start   clrf    INTCON      ; interrupts OFF
        movlw   low(Name)
        movwf   TBLPTRL              
        movlw   high(Name)
        movwf   TBLPTRH         ; point to Name table
        movlw   0xF0            ; EEPROM Name address        
        movwf   EEADR
        clrf    EECON1
        movlw   '#'             ; 
        rcall   WriteEE
Loop    tblrd*+                 ; read table and increment
        movf    EEADR,W
        bz      WR_VCal
        movf    TABLAT,W          ; W = TABLAT
        rcall   WriteEE
        bra     Loop
WR_VCal clrf   EEADR            ; 0x00 0101FA81
        movlw   0x01
        rcall   WriteEE
        movlw   0x01
        rcall   WriteEE
        movlw   high(VCal)
        rcall   WriteEE
        movlw   low(VCal)
        rcall   WriteEE
        bcf     TRISC,0         ; busy LED
Flash   clrwdt
        decfsz  WREG
        bra     $-2
        btg     LATC,0          ; flash busy LED 
        bra     Flash           ;
Name    data    MyJune
        data    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;padding
; enter W = Data, will auto increment EEADR
WriteEE bcf     PIR2,EEIF       ; clear EE flag
        clrwdt
        movwf   EEDATA          ; EEDATA = W
        bsf     EECON1,WREN     ; enable EEPROM writes
        movlw   0x55
        movwf   EECON2
        movlw   0xAA
        movwf   EECON2
        bsf     EECON1,WR
        nop
        btfss   PIR2,EEIF
        bra     $-2
        bcf     EECON1,WREN
        incf    EEADR
        return
        END
 
futz said:
So that's it? Just fix the software and it'll program 3.3V PICs? With no extra diodes or circuitry? Excellent! :D

Bill can you confirm this? Or will we still need to do that extra schematic in the manual of the junebug to program 3.3v pics?
 
I posted the diode schematic on the Microchip forums, I was told the diodes are unnessary on the 5V tolerent inputs on many 3.3V PICs. I'll consult the datasheets to see which 3.3V PICs have PGD & PGC 5V ratings.

The reason you can't calibrate the Junebug is it doesn't have a programmable VDD generator, but once it's calibrated It'll sense your targets VDD.

I'll put this into JPUG issue 2, I'd like to figure out the formula for calibration :)
(The PICkit2 puts out 4.2V on VDD and you're asked to measure it)
My USB is 5.03V and the result was 0xFA81 for a calibrated PICkit2.
 
Last edited:
Well here's the deal, most 3.3V PICs have 5V tolerent inputs on digital only I/O pins... (always check the datasheet)
The 18F67J60 PGC & PGD are on digital pins so no clamp diodes are needed, the 24F the PGC & PGD are on analog inputs so you do need the diodes. 1N5817 work fine.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top