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.

Unicorn (Inchworm+ ICD2 USB Upgrade) first look PCB

Status
Not open for further replies.
The layout is done, and sent to the PCB house. I'll post the schematic on my site. Here is Unicorn mounted to the bottom of an Inchworm+ (fast USB ICD2 mode)
The USB connector will take a mini B or type A, There is a socket for an I2C 24Lxxx EEPROM and the USER connector supports 5V SCL, SDA, A0,A1,A2,A3 & GND
**broken link removed**
 
blueroomelectronics said:
The layout is done, and sent to the PCB house. I'll post the schematic on my site. Here is Unicorn mounted to the bottom of an Inchworm+ (fast USB ICD2 mode)
The USB connector will take a mini B or type A, There is a socket for an I2C 24Lxxx EEPROM and the USER connector supports 5V SCL, SDA, A0,A1,A2,A3 & GND

So you will need the Inchworm+ and Unicorn to program your PIC's and use the mini-development board?
 
The Inchworm+ (and Inchworm) are stand alone PIC programmers & debuggers.

Unicorn is a USB upgrade for the Inchworm+. It is several times faster than the serial version as it uses the much higher USB data rates and it communicates with the 16F877 (Inchworm+) in parallel (not serial). Unicorn can also power the Inchworm+ and your target project but is limited to 250ma (thermal fuse on Unicorn that trips at 500ma).
Inchworms 1A power supply if used will allow for much higher project currents such as lighting those LCD backlights or small motors, servos etc...

Unicorn can transform into a project too. It can be switched between roles by simply unplugging from the bottom of the Inchworm+ and plugging in an LCD or GLCD and using a Inchworm programming cable. (It will work with original Inchworms in this mode).

You can still power the Inchworm from the USB in the project mode.

As an added bonus you can program the Unicorn using the Inchworm in serial mode, this also handy if you manage to corrupt the Unicorns firmware (it's been done). The Unicorn bootloader creator will be posted on my site when the PCBs are ready.

Below is a photo of a typical USB ICD2 clone, note the pair of PICs (a 16F877A and a 18F4550)
There are a handful of ICD2 clones described on this page.
http://www.icd2clone.com/wiki/Main_Page

PS note the USB LED (not actually supported by the ICD2 firmware, but most copies use it, heck I put it on the Unicorn just because... But you can use it when programming your own stuff)
**broken link removed**
 
Last edited:
The Unicorn PCBs arrived yay! I've partially built one and the Inchworm+ USB upgrade mode works like a charm. I made a last minute mistake on the board and shorted Q1's base and LED1 but since LED1 was only used in the experimenter mode simply leaving it and R7 out was the simple fix. Aside from that it's looking good. Can't wait to try some LCD & GLCDs.

**broken link removed**
 
Last edited:
gregmcc said:
When can we start ordering? :)
I'll be dropping PCBs off at dipmicro and Creatron this week. I've got to finish the user manual too.
I've been testing the 16x2 LCD, this software uses the BF flag and some LCDs take longer than others to initialize, that's why the startup code is worst case.

I've yet to figure out the Table commands in the 18 series...
Code:
    list    p=18F4550
    include <p18F4550.inc>
    
        CONFIG  FOSC = HS, WDT = OFF, LVP = OFF, DEBUG = ON
#define LCD_E   LATE,2
#define LCD_RS  LATE,0
#define LCD_RW  LATE,1
#define LCD_BL  LATB,3
#define LCD_DAT LATD

        cblock  0               ; ram starts at 0x000
        delay 
        temp    
        endc

        org     0 
        nop

Init    movlw   0x0A
        movwf   ADCON1
        movlw   b'11110111'
        movwf   TRISB
        clrf    TRISD           ; LCD Data output
        clrf    PORTE           ; LCD Control
        clrf    TRISE  
        clrf    LATE            ; zero output on E
        movlw   b'00000010'     ; use internal osc
        movwf   OSCCON          ; 32KHz internal clock           
      
;wait 50ms before using LCD
        movlw   .50           
        call    dly1ms
        movlw   .3
        movwf   temp            ; loop counter
_init3  movlw   0x30
        bsf     LCD_E
        movwf   LCD_DAT       ; LCD = 0x38         
        movlw   .50               ; 50ms delay
        bcf     LCD_E    
        call    dly1ms
        decfsz  temp
        bra     _init3          ; repeat 3 times 
        
        bsf     LCD_BL          ; turn on backlight

        movlw   0x38            ; eight bit display
        call    LCD_Ins
        movlw  0x01            ; clear display
        call    LCD_Ins
        movlw   0x0F            ; clear display
        call    LCD_Ins

        movlw   'H'
        call    LCD_Chr
        movlw   'i'
        call    LCD_Chr
         
        movlw   0xC0
        call    LCD_Ins
        movlw   'U'
        call    LCD_Chr
        movlw   'n'
        call    LCD_Chr
        movlw   'i'
        call    LCD_Chr
        movlw   'c'
        call    LCD_Chr
        movlw   'o'
        call    LCD_Chr
        movlw   'r'
        call    LCD_Chr
        movlw   'n'
        call    LCD_Chr
  
        bra     $        

; LCD entry routines watches busy flag
LCD_Chr bsf     LCD_RS          ; enable Charater mode
LCD_Ins bsf     LCD_E
        clrf    TRISD                ; make PORTD an output
        movwf   LCD_DAT         ; put data on LCD port
        bcf     LCD_E           ; latch byte to LCD
        movlw   0xFF     
        bcf     LCD_RS
        movwf   TRISD           ; make LCD port input
        bsf     LCD_RW          ; enter read mode
        bsf     LCD_E           ; enable LCD
_BusyFl btfsc   PORTD,7       ; wait for bit 7 to be pulled low
        bra     _BusyFl
        bcf     LCD_RW          ; return to Instruction mode

        return

dly1ms  movwf   delay           ; enter with delay in ms via W
_loop1  bra     $+2
        bra     $+2
        nop
        decfsz  delay
        bra     _loop1
        return
    END
 
Last edited:
I prefer putting string (tables) in-line with my code.

Here's a version I use specifically for PIC18 devices which utilizes TBLPTR and the stack.

Not for the faint of heart (grin), it pulls the string address (return address) off the stack and puts it in the TBLPTR registers, then uses the TBLRD *+ (table read, post increment) instruction to read and print the string one character at a time, then finally adjusts the return address on the stack to point at the first instruction following the in-line string.

Two characters are stored in each 16-bit memory word in the string table by using the db directive instead of the dt directive.

Regards, Mike

Example usage;
Code:
        call    PutString       
        db      "Main Menu\r\n\n\0" 
        call    PutString       
        db      "<1> Setup\r\n\0"
The PutString code;
Code:
;******************************************************************
;
;  PutString - print in-line string via Stack and TBLPTR
;
;  string must be terminated with a 00 byte and does not need
;  to be word aligned
;
PutString
        movff   TOSH,TBLPTRH    ; copy return address to TBLPTR
        movff   TOSL,TBLPTRL    ;
        clrf    TBLPTRU         ; assume PIC with < 64-KB
PutNext
        tblrd   *+              ; get in-line string character
        movf    TABLAT,W        ; last character (00)?
        bz      PutExit         ; yes, exit, else
        rcall   Put232          ; print character
        bra     PutNext         ; and do another
PutExit
        btfsc   TBLPTRL,0       ; odd address?
        tblrd   *+              ; yes, make it even (fix PC)
        movf    TBLPTRH,W       ; setup new return address
        movwf   TOSH            ; 
        movf    TBLPTRL,W       ;
        movwf   TOSL            ;
        return                  ;
;
;******************************************************************


And you can always use a macro to clean it up a little bit and make it look a little nicer in your source file;

Example usage;
Code:
;
         _Print  "Main Menu\r\n\n"
         _Print  "<1>  Setup\r\n"
         _Print  "<2>  Exit\r\n"
;
The _Print macro;
Code:
;******************************************************************
;
;  _Print macro
;
_Print  MACRO   str             ; print in-line string macro
        call    PutString       ;
        db      str,0
        ENDM
;
 
Nice code Mike, it's very helpful.

I've used the DT as it adds the retlw, and got to remember to skip a byte.

I'll play with TABLE in the simulator. Going to hook up the GLCD today, tables will be very handy.

PS found this GLCD zip on the net, has some fonts too. Not sure how useful it is.
 

Attachments

  • glcd.zip
    272.7 KB · Views: 150
Last edited:
I understand that, what I suggested was the mini B connector, which are smaller than either the regular A or B connectors:
**broken link removed**
https://www.electro-tech-online.com/custompdfs/2008/12/32005-601.pdf
(datasheet with dimensions)
MiniB normally comes with SMD package, through hole package is not so easy to find. Mini-B does save lot of space than a regular type B. The following picture is not the same scale, but does give some reference on size.
**broken link removed**
**broken link removed**
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top