View previous topic :: View next topic |
Author |
Message |
andys
Joined: 23 Oct 2006 Posts: 175
|
Problem with simple code |
Posted: Sun Sep 16, 2012 5:13 pm |
|
|
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
|
|
Posted: Sun Sep 16, 2012 5:41 pm |
|
|
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
|
Problem with simple code |
Posted: Sun Sep 16, 2012 5:50 pm |
|
|
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: 1934 Location: Norman, OK
|
|
Posted: Sun Sep 16, 2012 5:52 pm |
|
|
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
|
Problem with simple code |
Posted: Sun Sep 16, 2012 5:53 pm |
|
|
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: 9245 Location: Greensville,Ontario
|
|
Posted: Mon Sep 17, 2012 5:21 am |
|
|
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
|
Re: Problem with simple code |
Posted: Mon Sep 17, 2012 6:30 am |
|
|
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
|
Re: Problem with simple code |
Posted: Mon Sep 17, 2012 6:37 am |
|
|
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
|
Problem with simple code |
Posted: Mon Sep 17, 2012 1:50 pm |
|
|
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
|
|
Posted: Mon Sep 17, 2012 2:21 pm |
|
|
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. |
|
|
andys
Joined: 23 Oct 2006 Posts: 175
|
Problem with simple code |
Posted: Mon Sep 17, 2012 3:08 pm |
|
|
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
|
|
Posted: Mon Sep 17, 2012 3:21 pm |
|
|
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
|
Problem with simple code |
Posted: Mon Sep 17, 2012 4:06 pm |
|
|
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
|
Problem with simple code |
Posted: Mon Sep 17, 2012 4:14 pm |
|
|
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
|
|
Posted: Mon Sep 17, 2012 4:18 pm |
|
|
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);
}
} |
|
|
|
|