> The Crossworks tutorial states "To correct the error,
change the
> return type of factorial from void to int in its prototype."
// CrossWorks Tutorial
#include
void factorial(int);
int main(void)
{
int i;
for (i = 0; i < 10; ++i)
debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this
line: invalid use of void expression
return 0;
}
Read a book on Modula-2 or Oberon and you know what's wrong.
Or buy a book 'Data structures + Algorithms = Programs' by Prof
Niklaus
Wirth. You'll need it.
--
Met vriendelijke groeten,
Jan Verhoeven
http://www.verhoeven272.nl
Crossworks beginner
Started by ●February 17, 2011
Reply by ●February 17, 20112011-02-17
Reply by ●February 17, 20112011-02-17
Excellent book by Prof Wirth, one of many he wrote, that book has
been out for 35 years, a classic. I also still have my C manual by
Kernigan and Richie bought in the mid 70s.
At 11:25 AM 2/17/2011, you wrote:
> > The Crossworks tutorial states "To correct the error, change the
> > return type of factorial from void to int in its prototype."
>
>// CrossWorks Tutorial
>
>#include void factorial(int);
>
>int main(void)
>{
> int i;
> for (i = 0; i < 10; ++i)
> debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this
>line: invalid use of void expression
> return 0;
>}
>
>Read a book on Modula-2 or Oberon and you know what's wrong.
>Or buy a book 'Data structures + Algorithms = Programs' by Prof Niklaus
>Wirth. You'll need it.
>
>--
>Met vriendelijke groeten,
>
>Jan Verhoeven
>http://www.verhoeven272.nl
>
been out for 35 years, a classic. I also still have my C manual by
Kernigan and Richie bought in the mid 70s.
At 11:25 AM 2/17/2011, you wrote:
> > The Crossworks tutorial states "To correct the error, change the
> > return type of factorial from void to int in its prototype."
>
>// CrossWorks Tutorial
>
>#include void factorial(int);
>
>int main(void)
>{
> int i;
> for (i = 0; i < 10; ++i)
> debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this
>line: invalid use of void expression
> return 0;
>}
>
>Read a book on Modula-2 or Oberon and you know what's wrong.
>Or buy a book 'Data structures + Algorithms = Programs' by Prof Niklaus
>Wirth. You'll need it.
>
>--
>Met vriendelijke groeten,
>
>Jan Verhoeven
>http://www.verhoeven272.nl
>
Reply by ●February 17, 20112011-02-17
Sorry for double posting but I forgot the link to a free copy of the
Wirth Book;
<
http://www-old.oberon.ethz.ch/WirthPubl/AD.pdf
>
At 01:56 PM 2/17/2011, k5nwa wrote:
>Excellent book by Prof Wirth, one of many he wrote, that book has
>been out for 35 years, a classic. I also still have my C manual by
>Kernigan and Richie bought in the mid 70s.
>
>At 11:25 AM 2/17/2011, you wrote:
> > > The Crossworks tutorial states "To correct the error, change the
> > > return type of factorial from void to int in its prototype."
> >
> >// CrossWorks Tutorial
> >
> >#include
> >
> >void factorial(int);
> >
> >int main(void)
> >{
> > int i;
> > for (i = 0; i < 10; ++i)
> > debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this
> >line: invalid use of void expression
> > return 0;
> >}
> >
> >Read a book on Modula-2 or Oberon and you know what's wrong.
> >Or buy a book 'Data structures + Algorithms = Programs' by Prof Niklaus
> >Wirth. You'll need it.
> >
> >--
> >Met vriendelijke groeten,
> >
> >Jan Verhoeven
> >http://www.verhoeven272.nl
> >
> >
> >
> >
> >
Wirth Book;
<
http://www-old.oberon.ethz.ch/WirthPubl/AD.pdf
>
At 01:56 PM 2/17/2011, k5nwa wrote:
>Excellent book by Prof Wirth, one of many he wrote, that book has
>been out for 35 years, a classic. I also still have my C manual by
>Kernigan and Richie bought in the mid 70s.
>
>At 11:25 AM 2/17/2011, you wrote:
> > > The Crossworks tutorial states "To correct the error, change the
> > > return type of factorial from void to int in its prototype."
> >
> >// CrossWorks Tutorial
> >
> >#include
> >
> >void factorial(int);
> >
> >int main(void)
> >{
> > int i;
> > for (i = 0; i < 10; ++i)
> > debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this
> >line: invalid use of void expression
> > return 0;
> >}
> >
> >Read a book on Modula-2 or Oberon and you know what's wrong.
> >Or buy a book 'Data structures + Algorithms = Programs' by Prof Niklaus
> >Wirth. You'll need it.
> >
> >--
> >Met vriendelijke groeten,
> >
> >Jan Verhoeven
> >http://www.verhoeven272.nl
> >
> >
> >
> >
> >
Reply by ●February 17, 20112011-02-17
Hi all,I just want to send 1 at P0.6. and P0.5. I wrote this code in crossworks.
But it does not work when I flash it in lpc2138. Its so simple but I can,t do it
:(. Some one please guide??I am usingNXP LPC2000 CPU Support Package
version1.30.
#include #include #include
int main(void)
{
while(1){
IO0DIR = 0x00000000;IO0DIR = 0x00000060; // Set direction of P0.5 and P0.6 as out put.IO0SET = 0x00000060;// Set P0.5 and P0.6.
}
}
BRGDS,Aamir
#include #include #include
int main(void)
{
while(1){
IO0DIR = 0x00000000;IO0DIR = 0x00000060; // Set direction of P0.5 and P0.6 as out put.IO0SET = 0x00000060;// Set P0.5 and P0.6.
}
}
BRGDS,Aamir
Reply by ●February 17, 20112011-02-17
Reply by ●February 17, 20112011-02-17
Well, don't drop it completely, just move your 3 lines of code before it
(you don't really want to do those over and over, right?)
Reply by ●February 17, 20112011-02-17
Thanks for reply.Actualy the board is designed in a way that its always in sleep
mode and when it gets external intrupt it wakes up and gets power. Now as soon
as it wakes up it has to hold it own power by sending 1 to Pin P0.6 untill
finish task. What I want to do is I need a 1 at Pin P0.6 Permanently and at
P0.5 there is and LED that will show me that it is holding the power.By the way
when we just power up the processor whats on its IO ports 0 or 1??? so
basic...... :o.
--- On Thu, 2/17/11, brian_myers888 wrote:
From: brian_myers888
Subject: [lpc2000] Re: Crossworks beginner
To: l...
Date: Thursday, February 17, 2011, 12:44 PM
Well, don't drop it completely, just move your 3 lines of code before it (you don't really want to do those over and over, right?)
--- On Thu, 2/17/11, brian_myers888 wrote:
From: brian_myers888
Subject: [lpc2000] Re: Crossworks beginner
To: l...
Date: Thursday, February 17, 2011, 12:44 PM
Well, don't drop it completely, just move your 3 lines of code before it (you don't really want to do those over and over, right?)
Reply by ●February 17, 20112011-02-17
> // CrossWorks Tutorial
>
> #include void factorial(int);
>
> int main(void)
> {
> int i;
> for (i = 0; i < 10; ++i)
> debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this line: invalid use of void expression
> return 0;
> }
>
> Norm
>
Try to write this same program with gcc in Linux. If you get it working there, then 'port' it to the ARM.
A general advice from me: DO NOT try to learn programming on a micro controller. Learn it on a PC. Only THEN take the step to the embedded systems.
And: you LEARN the art of programming not in the IDE but in the DEBUGGER while single stepping.
Just my two cents.
>
> #include void factorial(int);
>
> int main(void)
> {
> int i;
> for (i = 0; i < 10; ++i)
> debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this line: invalid use of void expression
> return 0;
> }
>
> Norm
>
Try to write this same program with gcc in Linux. If you get it working there, then 'port' it to the ARM.
A general advice from me: DO NOT try to learn programming on a micro controller. Learn it on a PC. Only THEN take the step to the embedded systems.
And: you LEARN the art of programming not in the IDE but in the DEBUGGER while single stepping.
Just my two cents.
Reply by ●February 17, 20112011-02-17
Oook, I got your point, I set the pins and enter the while 1 and it will stay 1
untill I clear again r8?? and entering in infinite loop will never clear it and
I get 1 at both pins as long as its powered r8???
--- On Thu, 2/17/11, brian_myers888 wrote:
From: brian_myers888
Subject: [lpc2000] Re: Crossworks beginner
To: l...
Date: Thursday, February 17, 2011, 12:44 PM
Well, don't drop it completely, just move your 3 lines of code before it (you don't really want to do those over and over, right?)
--- On Thu, 2/17/11, brian_myers888 wrote:
From: brian_myers888
Subject: [lpc2000] Re: Crossworks beginner
To: l...
Date: Thursday, February 17, 2011, 12:44 PM
Well, don't drop it completely, just move your 3 lines of code before it (you don't really want to do those over and over, right?)
Reply by ●February 17, 20112011-02-17
To make long story short, try the following changes:
#include
#include
#include
int main(void)
{
IO0DIR = 0x00000060; // Set direction of P0.5 and P0.6 as out put
IO0SET = 0x00000060; // Set P0.5 and P0.6.
while(1);
}
--- In l..., aamir shakoor wrote:
>
> Oook, I got your point, I set the pins and enter the while 1 and it will stay 1 untill I clear again r8?? and entering in infinite loop will never clear it and I get 1 at both pins as long as its powered r8???
>
> --- On Thu, 2/17/11, brian_myers888 wrote:
>
> From: brian_myers888
> Subject: [lpc2000] Re: Crossworks beginner
> To: l...
> Date: Thursday, February 17, 2011, 12:44 PM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Well, don't drop it completely, just move your 3 lines of code before it (you don't really want to do those over and over, right?)
>
#include
#include
#include
int main(void)
{
IO0DIR = 0x00000060; // Set direction of P0.5 and P0.6 as out put
IO0SET = 0x00000060; // Set P0.5 and P0.6.
while(1);
}
--- In l..., aamir shakoor wrote:
>
> Oook, I got your point, I set the pins and enter the while 1 and it will stay 1 untill I clear again r8?? and entering in infinite loop will never clear it and I get 1 at both pins as long as its powered r8???
>
> --- On Thu, 2/17/11, brian_myers888 wrote:
>
> From: brian_myers888
> Subject: [lpc2000] Re: Crossworks beginner
> To: l...
> Date: Thursday, February 17, 2011, 12:44 PM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Well, don't drop it completely, just move your 3 lines of code before it (you don't really want to do those over and over, right?)
>