Chicken & Egg?

Status
Not open for further replies.

smurff

New Member
Hi All,

First post here so Hi Im new to pics and quite excited. (Nerdy I know but hey) and I have read the sticky here about newbies like me. There are a few sites I have read and as some are old and some are new I thought I would ask a few questions please. If they are stupid or exist somewhere else then I do appolagise.

I have decided to go with 18Fs. I see from the sticky that I can program them via USB without a hardware programmer but I would need a hardware programmer to put a bootloader on first. Is this really correct? I was hoping not to buy a hardware programmer. Can you buy PICs with the bootloader already on?

I would like to program in C and I am downloading boostC. Are there any good examples out there other than ones on the vendor site?

Thanks for your time guys
Merry xmas and take care
Danny
 
Buy a Junebug or PICKit2, programmer and debugger - then you can load your own bootloaders if you really want to.
 
A bootloader does not allow for ICD akd In Circuit Debugging. The $50 or so for a Junebug or PICkit2 is well worth the money go get it.

BoostC is a good compiler choice.
The difference between boostC and C18 are small from the syntax level. Given the basic layout of a simple bootC program it is easy to see how C18 programs can be modified to run with bootC.

This is a file I wrote that allows me to compile the same code using BoostC or C18. If you know C it should make the differences clear. Mostly it is setting up the chip, register and register bit field names. In this file the bootC #pragma DATA and C18 #prarma config settings are for a 18F1320 the junebutg target chip. They should be modified as needed.

Code:
/* 
 * Junebug Demo 
 * Purpose: Demonstrate cooporative multitasking 
 *
 * File: multiCompiler.h
 * Software: BoostC or Microchip C18 compilers
 * Hardware: Junebug (or other debugger + breadboarded circuit)
 *
 * These defiles allow the use of more then one compiler.
 * Register names ending with a single _ are byte referances.
 * Register names ending with a dual __ are bit referances.
 *
 * by Daniel Johnson
 * July 2008
 */
 
#ifdef _BOOSTC
  #define FOUND_COMPILER
  
  #define lata_     lata
  #define trisa_    trisa
  #define porta_    porta
  
  #define latb_     latb
  #define trisb_    trisb
  #define portb_    portb
  
  #define intcon_   intcon
  #define intcon2_  intcon2
  #define osccon_   osccon
  #define t0con_    t0con
  #define t0con__   t0con
  #define adcon1_   adcon1
  
  #include <system.h>
  #pragma CLOCK_FREQ 8000000
  #pragma DATA _CONFIG1H, _INTIO2_OSC_1H
  #pragma DATA _CONFIG2H, _WDT_OFF_2H
  #pragma DATA _CONFIG3H, _MCLRE_ON_3H
  #pragma DATA _CONFIG4L, _LVP_OFF_4L
#endif

// MCC18
#ifdef __18CXX
  #define FOUND_COMPILER
  
  #define lata_     LATA
  #define trisa_    TRISA
  #define porta_    PORTA
  
  #define latb_     LATB
  #define trisb_    TRISB
  #define portb_    PORTB
  
  #define intcon_   INTCONbits
  #define intcon2_  INTCON2bits
  #define osccon_   OSCCONbits
  #define t0con__   T0CONbits  
  #define t0con_    T0CON
  #define adcon1_   ADCON1
  
  #pragma	config OSC = INTIO2, WDT = OFF, LVP = OFF
  #include <p18f1320.h>
  
  // code to make C18 interrupt look like BoostC's
  void interrupt(void);
  
  #pragma code low_vector=0x18
  void low_interrupt (void)
  {
    _asm GOTO interrupt _endasm
  }
  #pragma code
  #pragma interruptlow interrupt
  
#endif

#ifndef FOUND_COMPILER
   error: unknown compiler
#endif
 
Last edited:
Buy a Junebug or PICKit2, programmer and debugger - then you can load your own bootloaders if you really want to.

Hi Nigel thanks for your reply. The only thing is maplin only do pickit and its for about £130. I dont want to sound a skin flint but thats more than I wanted to pay for a hobbie at the moment.

I see you are from england. Is there anywhere you can recommend or an alternative please?
 

3v0,

Thanks for the reply and the code. I will look at the junebug too. Wish there was someone in the UK selling them as I dont really want to wait weeks while it gets shipped to the UK

Thanks again.
 
Hi,

Thanks for the reply and the code. I will look at the junebug too. Wish there was someone in the UK selling them as I dont really want to wait weeks while it gets shipped to the UK

As mentioned in other recent threads the Pickit2 Debugger is on very special offer via the Everyday Practical Electronics Mag - view details online at EPE.
If you want one 'today' Farnells have them in stock at £35 + carriage
btw - I sent you a PM that might help

Richard
 
Thanks for the reply and the code. I will look at the junebug too. Wish there was someone in the UK selling them as I dont really want to wait weeks while it gets shipped to the UK

It doesn't usually take weeks, just a couple of days.
 
The original PK2 was on sale. My Junebug kit is a compatible but includes an 18F1320 for learning. Take a look at the JPUG issues on my site for more info on the tutor.
 
Please, whatever you do. Don't get the velleman PIC kit. I bought my programmer from E-Bay, it is "cheap-n-nasty" but does the job. I use SourceBoost IDE and PICPgm, they work very well together.

**broken link removed**
 
If you are living in UK, just get the genuine Microchip PicKit2 Programmer/Debugger via the EPE deal. It ends January next year. It also comes with a demo board with PIC, soldered LEDs, VR and push buttons.

All that delivered to your home and you even got change for a tenner.
 

Do I have to subscribe to the mag for that? I cant find the actual details on the web site. It just says details inside the mag. Anyone know what they are please? If not then I guess I could buy the back copy and wait for delivery.

Thanks
 
No subscription is needed. The offer is opened to anyone reading the magazine. Last time I checked it is also mentioned in the current month EPE magazine.

You can always give Mr. W.H.Smith a call if you want the details.
 
Last edited:
No subscription is needed. The offer is opened to anyone reading the magazine. Last time I checked it is also mentioned in the current month EPE magazine.

You can always give Mr. W.H.Smith a call if you want the details.

Can you believe it. I stopped at WHS at the train St in london on the way home from work. No EPE... got off the train and went to town. WHS/Tesco/Sainsburys no EPE.....

I have the discount code now (via the "not so good internet") but I did not want to miss out on this

Now I guess I sit back and wait and read all the good posts here.

Thanks again guys
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…