Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 9th December 2008, 03:25 PM   #1
Default Chicken & Egg?

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
smurff is offline  
Old 9th December 2008, 03:35 PM   #2
Default

Buy a Junebug or PICKit2, programmer and debugger - then you can load your own bootloaders if you really want to.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 9th December 2008, 03:56 PM   #3
Default

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
__________________
Please post questions to the forums. PM's are for personal communication.

BCHS/3v0's Tutorials
Junebug USB PIC programmer kit., USB Bit Whacker,
The 15 Minute Printed Circuit Board! (+drill time)

Last edited by 3v0; 9th December 2008 at 04:22 PM.
3v0 is offline  
Old 9th December 2008, 04:29 PM   #4
Default

Quote:
Originally Posted by Nigel Goodwin View Post
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?
smurff is offline  
Old 9th December 2008, 04:38 PM   #5
Default

Quote:
Originally Posted by 3v0 View Post
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
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.
smurff is offline  
Old 9th December 2008, 04:55 PM   #6
Default

Wasn't there a deal on the PICkit2 in the UK?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com/
blueroomelectronics is offline  
Old 9th December 2008, 04:58 PM   #7
Default

Hi,

Quote:
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
richard.c is offline  
Old 9th December 2008, 04:59 PM   #8
Default

Quote:
Originally Posted by blueroomelectronics View Post
Wasn't there a deal on the PICkit2 in the UK?
Really?

Anyone un the UK want to sell me thier Junebug?
smurff is offline  
Old 9th December 2008, 05:00 PM   #9
Default

Quote:
Originally Posted by smurff View Post
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 9th December 2008, 05:11 PM   #10
Default

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.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com/
blueroomelectronics is offline  
Old 9th December 2008, 05:18 PM   #11
Default

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.

JDM PIC Programmer Microchip 16F84 - 40 & 18 ZIF Socket on eBay, also Assemblies EM Devices, Components Supplies, Electrical Test Equipment, Business, Office Industrial (end time 01-Jan-09 09:57:36 GMT)
__________________
when you post that reply, im just kidding.
danielsmusic is offline  
Old 9th December 2008, 05:51 PM   #12
Default

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.
__________________
L.Chung
eblc1388 is offline  
Old 9th December 2008, 06:53 PM   #13
Default

Quote:
Originally Posted by eblc1388 View Post
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
smurff is offline  
Old 9th December 2008, 07:13 PM   #14
Default

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.
__________________
L.Chung

Last edited by eblc1388; 9th December 2008 at 07:15 PM.
eblc1388 is offline  
Old 9th December 2008, 09:24 PM   #15
Default

Quote:
Originally Posted by eblc1388 View Post
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
smurff is offline  
Reply

Tags
chicken, egg

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
Chicken Incubator Humidifier Help ainsof Electronic Projects Design/Ideas/Reviews 7 23rd April 2009 02:22 AM
Chicken coop door control perthdownunder Electronic Projects Design/Ideas/Reviews 9 16th December 2008 10:05 PM
Bipedal Chicken Walker ultimatekiller Robotics Chat 2 9th October 2007 04:45 AM



All times are GMT. The time now is 05:19 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker