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

Problem with simple code
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
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

Problem with simple code
PostPosted: Sun Sep 16, 2012 5:13 pm     Reply with quote

I created the simple code (as presented below)
Code:

#include <18F4550.h>
#FUSES NOWDT, HS, PUT, NOPROTECT, NODEBUG, BROWNOUT, NOLVP, NOCPD, NOWRT     
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)

void main()
{

while(1)
  {
   output_low(pin_A0);
   delay_us(20);
   output_high(pin_A0);
  }
}

When I tried to compile the code I get the following message:

#__DEBUG=1 +ICD +DF +LN +T +A +M +Z +Y=9 +EA #__18F4550=TRUEBUILD FAILED: Mon Sep 17 02:12:19 2012

Is anyone who know what is going wrong?
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Sun Sep 16, 2012 5:41 pm     Reply with quote

Even if the compiler error is fixed it isn't going to work. Take a look at your code
while(1)
{
output_low(pin_A0);
delay_us(20);
output_high(pin_A0);
}
output_high is immediately followed by output low at 20 mhz that means just a few millionths of a second before the high is replaced with a low.
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

Problem with simple code
PostPosted: Sun Sep 16, 2012 5:50 pm     Reply with quote

ok i will increase the delay to 2000

delay_us(2000);

but my problem is : why i get the message that the project is built failed
?????????????????????????????
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun Sep 16, 2012 5:52 pm     Reply with quote

Please show all the lines generated by the build...not just one.
_________________
Google and Forum Search are some of your best tools!!!!
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

Problem with simple code
PostPosted: Sun Sep 16, 2012 5:53 pm     Reply with quote

i get only the message :


Executing: "C:\Program files\Picc\CCSC.exe" +FH "..\try_ccs\main.c" +DF +LN +T +A +M +Z +Y=9 +EA #__18F4550=TRUEBUILD FAILED: Mon Sep 17 02:47:03 2012
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Sep 17, 2012 5:21 am     Reply with quote

We need to see your whole program again not just the error message.
Something else is wrong...


Also...
when using the hardware UART always add 'errors' to the #use RS232(..) line. While not the problem here...if you don't add 'errors', then the UART will 'lockup' or shutdown when >3 characters come in.

hth
jay
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

Re: Problem with simple code
PostPosted: Mon Sep 17, 2012 6:30 am     Reply with quote

andys wrote:
ok i will increase the delay to 2000

delay_us(2000)
That's not the problem pointed to by Douglas. Read his post again, but now more carefully.

About your compile error. Post your compiler version too.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

Re: Problem with simple code
PostPosted: Mon Sep 17, 2012 6:37 am     Reply with quote

I know this isn't you main problem but:
ckielstra wrote:
andys wrote:
ok i will increase the delay to 2000

delay_us(2000)
That's not the problem pointed to by Douglas. Read his post again, but now more carefully.

About your compile error. Post your compiler version too.


To generate a square wave you need a low time and a high time. How long is your high time?
_________________
The search for better is endless. Instead simply find very good and get the job done.
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

Problem with simple code
PostPosted: Mon Sep 17, 2012 1:50 pm     Reply with quote

I used :

MPLAB IDE v8.85
Suite_CCSPic Version:2.0.013


Is anyone with any idea what is the problem?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 17, 2012 2:21 pm     Reply with quote

You have been on the forum for 6 years and still don't know how to
blink an LED in a loop, or how to post the compiler version. Bummed Out
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

Problem with simple code
PostPosted: Mon Sep 17, 2012 3:08 pm     Reply with quote

I will say again i don't care about the code MY PROBLEM IS THE COMPILATION.

The code for blinking led is :

Code:

void main()
{
while (1)
{
output_high(pin_A0);
delay_ms(500);
output_low(pin_A0);
delay_ms(500);
}


How to check the version of the compiler ?
(Sorry PCM compiler but i did not used it again)
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 17, 2012 3:21 pm     Reply with quote

Here are some ways to find the compiler version:

1. Compile a test file, and look at the top of the .LST file, which will
be in your project folder. It will show the version. However, to get
the .LST file to be generated, the source file must compile with no errors.

2. Click on the Start button in Windows, then go to Programs, and then
find the entry for CCS, which will be called "PIC-C". Then click on the icon
for "Compiler Version". It will display a box which shows the compiler
version. This method may only work for version 4.xxx of the compiler.

2. Open a Command Prompt window and go to c:\Program Files\Picc
and run this command line: CCSC.exe +v
This method should always work.
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

Problem with simple code
PostPosted: Mon Sep 17, 2012 4:06 pm     Reply with quote

IDE Version 4.057
PCB Version 4.057
PCM Version 4.057
PCH Version 4.057
PCD Version 4.057
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

Problem with simple code
PostPosted: Mon Sep 17, 2012 4:14 pm     Reply with quote

I just realize that i can compile pic18f4550 but i can compile the series dspic30,....


I can't understand because the pch compiler is exist
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 17, 2012 4:18 pm     Reply with quote

I compiled this program with vs. 4.057 and ran it on my PicDem2-Plus
board. It works. It creates a 1 Hz signal on Pin A0.
Code:

#include <18F4550.h>
#fuses HS, NOWDT, PUT, NOPROTECT, NODEBUG, BROWNOUT, NOLVP, NOCPD, NOWRT     
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

void main()
{

while(1)
  {
   output_high(pin_A0);
   delay_ms(500);
   output_low(pin_A0);
   delay_ms(500); 
  }
}
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