CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

New to PIC programming...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
SBS



Joined: 15 Aug 2005
Posts: 18

View user's profile Send private message

New to PIC programming...
PostPosted: Mon Aug 15, 2005 11:02 am     Reply with quote

Hi,

I'm working on my startup business and I'll be using the PIC processor in my product. I am going to be using one of the higher pin count chips 30-40 pins. The PIC processor will need to interface with the following:

- Analog to Digital Converter
- LCD driver/screen
- Keypad
- RS232

I'm leaning towards the windows compiler since I have very little PIC programing experience. I have a few very basic questions that I hope you will be able to help with.

1) The PICW compiler does NOT include any sort of emulation, correct?

2) Can I use the PICW compiler to download the code to my PIC processor? Or do I need a separate piece of software?

3) From the pictures on your website, it doesn't look like the high pin count PIC that I'll be using will fit into any of your programmers. Is this correct?

4) I haven't found any programmers on the internet that will accomodate the high pin count PICs. What do you suggest?

5) What kind of info does the ICD (in circuit debubber) give me? Does that work with the PICW compiler?

6) Do you know anything about in-circuit programming? That is, re-programming the processor after it is already soldered into the circuit?

I hope you can help me with these questions. Thanks for your time.
jds-pic



Joined: 17 Sep 2003
Posts: 205

View user's profile Send private message

Re: New to PIC programming...
PostPosted: Mon Aug 15, 2005 11:41 am     Reply with quote

SBS wrote:
I am going to be using one of the higher pin count chips 30-40 pins.

ok.

SBS wrote:
1) The PICW compiler does NOT include any sort of emulation, correct?

no, CCS's products (incl PCWH) do not do emulation / simulation. however, Microchip's free tool, MPLAB, does do simulation. and, there is "plug-in" support for MPLAB, such that you can use PCWH within it. write code in C (PCWH), compile (PCWH), run through simulator (MPLAB).

SBS wrote:

2) Can I use the PICW compiler to download the code to my PIC processor? Or do I need a separate piece of software?

there are at least three ways to program a PIC with your code...
a) in a hardware fixture, e.g. Microchip PRO MATE II, and a programming tool such as MPLAB.
b) ICSP (in-circuit serial programming) using a Microchip MPLAB ICD 2 or similar tool.
c) via a serial port ONCE YOU HAVE A BOOTLOADER ON THE DEVICE.

SBS wrote:
3) From the pictures on your website, it doesn't look like the high pin count PIC that I'll be using will fit into any of your programmers. Is this correct?

you want to do ICSP using the MPLAB ICD2 "hockey puck".

SBS wrote:
4) I haven't found any programmers on the internet that will accomodate the high pin count PICs. What do you suggest?

you want to do ICSP (and also ICD) using the MPLAB ICD2 "hockey puck".

SBS wrote:
5) What kind of info does the ICD (in circuit debubber) give me? Does that work with the PICW compiler?

PCWH is a compiler, not a debugging tool. use MPLAB's debugger for debugging running applications (e.g. breakpoints etc).

SBS wrote:
6) Do you know anything about in-circuit programming? That is, re-programming the processor after it is already soldered into the circuit?

the absolute best way to program, reprogram, and debug your device and associated logic is via ICSP. get an MPLAB ICD2, they are inexpensive and will do a lot for you. the actual ICD circuit that you'll put on your board is dead-nuts simple, and there are reference implementations on the Microchip website.

jds-pic
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Mon Aug 15, 2005 11:43 am     Reply with quote

1)emulation can be done with Microchip MPlab. (free download)
2)the 3 compilers are divided up by the processors they support.
If I were you I would get all 3 and an PIC Dem 2 plus from microchip
3)You can program AND debug through ICD. Once the code is stable and your mass producing, you can have arrow program them for you.
4)Most programmers can do "higher" pin counts with and adapter. Again. you can allways use the ICD tho.
5)CCS will give you the ICD software when you buy a ICD-U40. You can step through programs and watch variables ect.
6)As long as the circuit doesn't interfere with the ICD pins too much, you can plug in a cable and reprogram the pic.
Also you could use a bootloader.
This is a small chunk of code that sits in a reserved area of mem. Then if you are communicating to say a PC through the rs232 ports of PIC you can send a 'special' command that tells the PIC the next data is to reprogram the PIC. The PIC stores the data as a new program and is restarted. This way circuit is 'field' reprogramable.

If you ask nicely and give details about the project, MANY of us will give you ways/ techniques to design the product. ie: why do you need so many pin. You could use a IO expander if the speed is slow enough. But start a new thread. subject: idea for product.
Guest








Re: New to PIC programming...
PostPosted: Mon Aug 15, 2005 11:49 am     Reply with quote

Quote:

- Analog to Digital Converter
- LCD driver/screen
- Keypad
- RS232


The PICDEM-2Plus demo board from Microchip has A/D, LCD, rs232, and a few pushbuttons (no keypad). It's a great starter's kit, as well as a good board to have for proof of concept.

Quote:

I'm leaning towards the windows compiler since I have very little PIC programing experience. I have a few very basic questions that I hope you will be able to help with.

1) The PICW compiler does NOT include any sort of emulation, correct?
2) Can I use the PICW compiler to download the code to my PIC processor? Or do I need a separate piece of software?
3) From the pictures on your website, it doesn't look like the high pin count PIC that I'll be using will fit into any of your programmers. Is this correct?


First of all, which PIC will you be using? I suggest to go with an 18F series PIC. Then you'll need to purchase either PCH or PCWH (don't forget the 'H', which is for the PIC18.

Quote:

4) I haven't found any programmers on the internet that will accomodate the high pin count PICs. What do you suggest?


The ICDU-40 from CCS or the ICD-2 from Microchip. The ICDU-40 cannot debug in the MPLAB environment though, while the ICD-2 can.

5) What kind of info does the ICD (in circuit debubber) give me? Does that work with the PICW compiler?

Quote:


6) Do you know anything about in-circuit programming? That is, re-programming the processor after it is already soldered into the circuit?


In-circuit programming means just that -- programming an reprogramming a chip while in the circuit. no need to pop it out of the socket. You will need a 6 pin connector though (see the PICDEM2-Plus user's manual at Microchip.com), which is usually an RJ11.
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Mon Aug 15, 2005 11:50 am     Reply with quote

This forum isn't really watched by the folks at CCS, just those of us that use their products. Sounds like you want to contact someone in technical support or sales. That said, I can help with a few of your questions - I'm sure others can answer the rest.

1) CCS doesn't feature any emulation, but Microchip's MPLAB does. If you want, you can compile your c code from within MPLAB, and do your emulation there. There are lots of good posts on this here, search for them.

2) The compiler is just that - a compiler. You'll need a programmer and its software to flash the PIC itself. CCS makes a programmer/ICD - the ICD-U40 (USB) or ICD-S40 (serial). It comes with its own s/w. The debugger can be run from within PCW, but I've never actually used it before.

3) The way to program in-circuit is to bring out the PGD (data) and PGC (clock) lines to a programming header. You'll also need to bring out VDD, GND, and the MCLR/VPP line as well. If you plan to do in circuit debugging, you'll need to bring out that line to the header too. On most PICs, I believe this line is B3 (or is it B5?) As long as the PGD and PGC lines don't go to other things on your board, this is sufficient for in-circuit programming. Programmers tend to object to these lines being routed to other electronics, so you may need switches/headers to isolate these lines when programming, if they are connected to other things. Take a look at the schematic for ME Labs' LAB-X1 board: www.melabs.com You'll see how they bring these signals out to a 10 pin header for programming by their EPIC programmer.

4) The CCS ICD-U40 handles almost all (if not all) PICs. The nice thing about this programmer is that it can program the LF PICs (low voltage) in-circuit. I had a lot of difficulty finding another programmer that could do this.

5) It works with PCW, yes, but I've never used it. Not sure what information is available.

6) See 3) above, and search through this forum. Lots of information about this is available.

Hope this helps.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

Re: New to PIC programming...
PostPosted: Mon Aug 15, 2005 11:55 am     Reply with quote

1) The PICW compiler does NOT include any sort of emulation, correct?
Nope, but MPLAB does. I wouldn't buy PCW or PCWH. Instead, I'd use either PCM (PIC16's) or PCH (PIC18's) and use Microchip's free IDE and simulator or ICD2.

2) Can I use the PICW compiler to download the code to my PIC processor? Or do I need a separate piece of software?
MPLAB with the ICD2 will let you do this.

3) From the pictures on your website, it doesn't look like the high pin count PIC that I'll be using will fit into any of your programmers. Is this correct? You can program in-circuit with an ICD2 and later move to a production in-circuit programmer when you want.

4) I haven't found any programmers on the internet that will accomodate the high pin count PICs. What do you suggest? Well they are out there. Microchip make the PM3 which programs pics.

5) What kind of info does the ICD (in circuit debubber) give me? Does that work with the PICW compiler? The ICD will allow to step through code, setup break points (usually only one though), look at registers, look at the internal eeprom, download firmware.

6) Do you know anything about in-circuit programming? That is, re-programming the processor after it is already soldered into the circuit?
In-circuit programming means just that. Programming the chip in the circuit. It doesn't really have anything to do with reprogramming.
MikeValencia



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Mon Aug 15, 2005 12:04 pm     Reply with quote

I was "Guest" above, just forgot to sign in.

I agree with Mark when he suggests to use MPLAB and to purchase PCH instead of PCWH.

So you'll just need:
1. MPLAB ICD-2 (which you can debug and emulate in the free MPLAB environment)

2. PCH or PCM or PCx (i forgot what the other one was)

3. MPLAB IDE.

That's the cheapest and most efficient way to program, debug, emulate, etc. a PIC system.

Heck, in fact you don't really need a programmer unless you'll be programming several each day on the production line. The ICD-2 can flash a part in a few seconds. And if you use an RJ11 connector, which readily mates with the ICD2, then you can plug it in and out easily.

~~~~~~~~

You asked about emulating and debugging earlier. Personally, i'd rather use rs232 and dump messages to Hyperterminal. I work on motor control applications where i just cant get reliable info if i set breakpoints in mplab, especially since i shouldn't be freezing the processor and letting the motor run away.
SBS



Joined: 15 Aug 2005
Posts: 18

View user's profile Send private message

PostPosted: Mon Aug 15, 2005 12:17 pm     Reply with quote

Hi Mike,

Great. Thank you (and everyone else who had replied) for your very informative and helpful replies...

Let me recap to make sure I understand everything.

1) Use the free MPLAB environment... this will accept C style programming and allow me to emulate the PIC processor to debug my code.

2) Buy the cheaper command line compiler to turn my C code into assembly. It doesn't have the fancy debugger and user interface that the PCW has. But I don't need it since I'm programming it in MPLAB.

3) Download code to my own prototype board using hte MPLAB ICD-2. Use it to debug my hardware and see exactly what the PIC is doing. When I'm ready to go into production, I can make a simple socket board that can be programmed through the ICD. Just a few wires to connect.

Have I missed anything?

Thanks again for all your help.

-Sal
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Aug 15, 2005 12:24 pm     Reply with quote

That's about it. If you are using dip style chips, Microchip makes a universal programming module that works with the ICD's. You could also add a small header to the board and do in-circuit programming on the boards.
MikeValencia



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Mon Aug 15, 2005 12:56 pm     Reply with quote

I'd also like to mention the following.

ICDU from CCS (it's inexpensive) can also work as a standalone programmer. All you need is the .hex file. But unlike the ICD-2, the ICDU cannot be used for debugging in the MPLAB environment (but it can be used in the PCWH environment).

I'll admit that I like the ICDU better though. It is more robust than the ICD-2. I have a circuit that energizes relays when i turn on the power, and it occasionally kills my ICD-2. My ICDU has never gotten fried by this same circuit. I do have diodes in my darlington driver which supposedly quench the coil spikes, but it doesn't seem to work to protect my ICD-2.

So as of late, my setup uses:
MPLAB + PCH for editing & compiling
RS232 debug messages to Hyperterminal for debugging
ICDU for programming.

The only cost to you then is to buy PCH and one or more of the ICD programmers of your choice.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Aug 15, 2005 1:00 pm     Reply with quote

I haven't killed a ICD2 yet but I know that if I do, Microchip will replace it for free.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Mon Aug 15, 2005 1:00 pm     Reply with quote

YES,
but when going to production, don't think of it as a socket board.

Its a header with 6 pins. perhaps a RJ6 "phone" plug.
look at this link page 17
http://ww1.microchip.com/downloads/en/DeviceDoc/51331B.pdf

follow there guide lines on "DO's" and DON'T".

You can program and debug through these 6/5 pins
jds-pic



Joined: 17 Sep 2003
Posts: 205

View user's profile Send private message

PostPosted: Mon Aug 15, 2005 1:06 pm     Reply with quote

SBS wrote:

1) Use the free MPLAB environment... this will accept C style programming and allow me to emulate the PIC processor to debug my code.
2) Buy the cheaper command line compiler to turn my C code into assembly. It doesn't have the fancy debugger and user interface that the PCW has. But I don't need it since I'm programming it in MPLAB.
3) Download code to my own prototype board using hte MPLAB ICD-2. Use it to debug my hardware and see exactly what the PIC is doing. When I'm ready to go into production, I can make a simple socket board that can be programmed through the ICD. Just a few wires to connect.

Have I missed anything?


works for me!!!
http://losdos.dyndns.org:8080/public/verymisc/DSC00432_sm.jpg

although i use PCWH for the IDE environment, i prefer it to the command line version for a couple of reasons.

jds-pic
SBS



Joined: 15 Aug 2005
Posts: 18

View user's profile Send private message

PostPosted: Tue Aug 16, 2005 2:55 pm     Reply with quote

Ok... I couple more questions..

I downloaded the MPLAB IDE to fool around with. I was unable to find anywhere in it a C style editor.

I understand that MPLAB can emulate assembly code and let you step through it. I also understand that the PCH compiler from CCS is a command line comiler. Can you write C style code in MPLAB and then target the PCH compiler? Then step through the compiled assembly code?

Or do I need a separate third party C code editor program... compile the c file at the command prompt and then bring the assembly into MPLAB?

When in the MPLAB emulation, is there any what that I can step through the C code? Or will my breakpoints be stopping in the assembly?

On a side note... I don't really understand why anyone would buy the CCS PCWH Windows IDE... Couldn't the exact same functionality be acquired by using a free download C aware editor and the command line compiler? I know that the PCWH has a built in debugger for use with the ICD-U40. Would that debug C code? I mean that would it be stepping through the C code or would I just see the breakpoints in the assembly?

Thanks for all of your help!!!

-Sal
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Aug 16, 2005 3:10 pm     Reply with quote

Here is a screenshot of the MPLAB IDE. Look at the window titled
C:\..\Main.c
You can't see it in that screenshot, but it has colored syntax.
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469&part=SW007002
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group