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 support@ccsinfo.com

PIC184520 need tutorials and sample code please
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
coden4fun



Joined: 04 Feb 2009
Posts: 9

View user's profile Send private message Send e-mail AIM Address MSN Messenger

PIC184520 need tutorials and sample code please
PostPosted: Wed Feb 04, 2009 9:22 pm     Reply with quote

Hi, I'm new to microcontrollers and well all I have been able to do is compile

a printf("hello world");

however, it being connected to a ICD 2 in MPLAB using the CCS Compiler I don't know where the printf is printing out to or if it's not.

When I compile and debug my code it's compiles, builds, and runs just fine, but nothing is output at all.

I'm completely new PIC programming but I'm familiar with C as I am a .Net developer and have been working in C++ and C# for 2 years.

I have been through this forum, Microchips forum, microchips samples, and have done an extensive search on google that has lasted for 2 days

and I have yet to get this board to light up and LED.

I don't know what functions to call, I don't know what jumpers should be here or there, and there's no good step-by-step tutorial on PICDEM2 Plus board using CCS C compiler getting this board up and running.

I'm frustrated beyond belief, but I have yet to give up.

Someone please help me tonight

I'll be on AIM I'm on now, and I will continue to search

I have also search on CCS forum, and archive but only got a political debate on the PIC184520 only having shipped x amount of chips.

Please help me I'm frustrated beyond belief, and I just need help get a jump start on what to call in my main.c file, where the classes, functions are that i can call using the CCS C compiler and then I'm sure I can do the rest.

Thanks in advance.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 04, 2009 9:39 pm     Reply with quote

Which version of the PicDem2-Plus board do you have ?
Does it look exactly like this one ?
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010072

Or does it look like this one ?
http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DM163022
Note the differences in the "prototype area" on the right side of the
boards, below the LCD. That's a quick way to tell which one you have.

Do you have the PCH compiler from CCS ? The following program should
blink the LED on pin B0. Jumper J6 must be installed for this to work.
The PicDem2-Plus board (both versions) has an external "can" oscillator
instead of a crystal. That's why EC_IO fuse is used instead of the XT fuse.
Code:

#include <18F4520.H>
#fuses EC_IO,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)

//========================
void main()
{
 
while(1)
  {
   output_high(PIN_B0);
   delay_ms(500);
   output_low(PIN_B0);
   delay_ms(500);
  }   

}
coden4fun



Joined: 04 Feb 2009
Posts: 9

View user's profile Send private message Send e-mail AIM Address MSN Messenger

PostPosted: Wed Feb 04, 2009 9:53 pm     Reply with quote

Thanks, I'll try it out.

I have the board that is featured in your second link.

Thanks for the reply.

Is there a way I can talk to you on AIM ? coden4fun aim or csfinch@live.com on MSN

Thanks for the quick reply so quickly.

I'm just a little confused on how to start, and hopefully once I start and get some good tutorial, article or book I can reference then I can just go to town.

again thanks for your reply. kudos!!!
coden4fun



Joined: 04 Feb 2009
Posts: 9

View user's profile Send private message Send e-mail AIM Address MSN Messenger

PostPosted: Wed Feb 04, 2009 9:57 pm     Reply with quote

PCM programmer wrote:
Which version of the PicDem2-Plus board do you have ?
Does it look exactly like this one ?
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010072

Or does it look like this one ?
http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DM163022
Note the differences in the "prototype area" on the right side of the
boards, below the LCD. That's a quick way to tell which one you have.

Do you have the PCH compiler from CCS ? The following program should
blink the LED on pin B0. Jumper J6 must be installed for this to work.
The PicDem2-Plus board (both versions) has an external "can" oscillator
instead of a crystal. That's why EC_IO fuse is used instead of the XT fuse.
Code:

#include <18F4520.H>
#fuses EC_IO,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)

//========================
void main()
{
 
while(1)
  {
   output_high(PIN_B0);
   delay_ms(500);
   output_low(PIN_B0);
   delay_ms(500);
  }   

}


I have received the following error

*** Error 111 "main.c" Line 2(7,71): Unknown keyword in #FUSES "NOLVP"
*** Error 128 "main.c" Line 5(2,6): A #DEVICE required before this line
3 Errors, 0 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Wed Feb 04 22:44:29 2009
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 04, 2009 10:09 pm     Reply with quote

It works for me. It compiles OK with PCH vs. 4.085:
Quote:
Executing: "C:\Program Files\PICC\Ccsc.exe" "PCH_Test.c" +FH +DF +LY -T -A +M -Z +Y=9 +EA -EW
Memory usage: ROM=0% RAM=0% - 0%
0 Errors, 0 Warnings.
Loaded C:\Program Files\PICC\Projects\PCH_Test\PCH_Test.cof.
BUILD SUCCEEDED: Wed Feb 04 19:54:37 2009

What's your compiler version ? It's a number in this format: x.xxx

If you have a modern version of the CCS compiler (last three years or
so) then CCS has a tutorial on how to setup the compiler with MPLAB,
complete with screenshots:
http://www.ccsinfo.com/faq.php?page=ccs_mplab

You can download the MPLAB "plug-in" from this page:
http://www.ccsinfo.com/downloads.php
coden4fun



Joined: 04 Feb 2009
Posts: 9

View user's profile Send private message Send e-mail AIM Address MSN Messenger

PostPosted: Wed Feb 04, 2009 10:14 pm     Reply with quote

I don't think that's the problem, for I have the latest version 4.086 PCH PCM PCD

and the latest MPLAB IDE all in pro trial version

could it be 18f452.h instead of 18f4520.h ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 04, 2009 10:22 pm     Reply with quote

Can you post a link to the web page that has the specs for this "pro trial
version" ?

Also, the web page here shows only vs. 4.085. It's possible there is a
4.086, but I'd like to see a link to it.
http://www.ccsinfo.com/devices.php?page=versioninfo
coden4fun



Joined: 04 Feb 2009
Posts: 9

View user's profile Send private message Send e-mail AIM Address MSN Messenger

PostPosted: Wed Feb 04, 2009 10:28 pm     Reply with quote

yeah, do you have an IM so we can just talk straight from the IM instead of posting and reading?

here's the link

http://www.ccsinfo.com/content.php?page=compdemo
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 04, 2009 10:31 pm     Reply with quote

That's the demo. It only supports the specific PICs that are listed on
that page.
http://www.ccsinfo.com/ccsfreedemo.php
coden4fun



Joined: 04 Feb 2009
Posts: 9

View user's profile Send private message Send e-mail AIM Address MSN Messenger

PostPosted: Wed Feb 04, 2009 10:34 pm     Reply with quote

so which one do I download and install and which one do I remove then?

I mean can I program my board I have with a trial version of the CCS C compiler somewhere?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 04, 2009 10:41 pm     Reply with quote

You have got to have some version of the CCS compiler that supports
your PIC.

Do you have a link to some other version than the demo ?
If so, post it. It will probably say which PICs it supports.
coden4fun



Joined: 04 Feb 2009
Posts: 9

View user's profile Send private message Send e-mail AIM Address MSN Messenger

PostPosted: Wed Feb 04, 2009 10:47 pm     Reply with quote

which PIC should it support?

PIC18 right?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 04, 2009 10:53 pm     Reply with quote

You said you have a PicDem2-Plus board. Look at the IC's that you
got with that board (read the part numbers on the top of the ICs)
and post which PICs you have.
coden4fun



Joined: 04 Feb 2009
Posts: 9

View user's profile Send private message Send e-mail AIM Address MSN Messenger

PostPosted: Wed Feb 04, 2009 10:56 pm     Reply with quote

PCM programmer wrote:
You said you have a PicDem2-Plus board. Look at the IC's that you
got with that board (read the part numbers on the top of the ICs)
and post which PICs you have.


IC's I'm new to all of this. I really don't know what to look for at all. A company gave this to me to mess around with, and they were going to set it up at the company, but they didn't have time to do some debugging, so they didn't set it up.

All I know is I have

PICDEM 2 Plus Demo Board 2006 the chip has 4520LCDr1.HEX

The only thing I have is that board, lan RJ45, power cable and an ICD 2 debugger
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 04, 2009 11:14 pm     Reply with quote

OK. It's apparent that you have an 18F4520 PIC, which has a label on it.
The label refers to the program that is pre-programmed into that PIC by
the Microchip factory. But the CCS demo doesn't support that PIC.

If you want to use the CCS demo, I suggest that you buy one of the
PICs on the list that the demo supports. For example, you could buy
the 18F458 in the 40-pin DIP package. Here is the website:
http://www.mouser.com
Mouser Part #: 579-PIC18F458-I/P
Manufacturer Part #: PIC18F458-I/P
The cost is about $8 (USD) plus shipping.
Remember, the CCS demo is only good for one month. Then it shuts off.

Or, you could buy the command-line PCH compiler, and integrate it
with MPLAB (a free download from the Microchip website). It's $200 USD.
http://www.ccsinfo.com/content.php?page=Purchasing1

Or, maybe there's some other deal available somewhere.
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