Stepper Motor code problem

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Split form 11 YO tutorial - JS  http://www.avrfreaks.net/forum/c...

 

Hello...

 

I want to use this code in a porject of mine but when i compile it ill get a few errors.

 

I don´t knew what should i can do because i´m a newbie in C programming.

 

 

||=== Build: default in test (compiler: ImageCraft AVR Compiler) ===|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|10| extra token "__iom16_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|20| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|30| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|0|[warning] empty input file|
C:\Dokumente und Einstellungen\Admin\Desktop\test\putchar.c|16| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\putchar.c|31| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\putchar.c|46| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|10| extra token "__iom16_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|20| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|30| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\putchar.c|16| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\putchar.c|31| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\putchar.c|46| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|108| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|148| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|166| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|182| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|186| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|190| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|215| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|246| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|326| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|331| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|336| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|364| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|373| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|477| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|483| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|489| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|506| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|510| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|514| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|155| undeclared identifier `NULL'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|155| initializer must be constant|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|155| too many initializers|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|198|[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|198|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|198| undeclared identifier `ESC'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|201|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|202|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|204|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|205|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|207|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|208|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|210|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|211|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|213|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|214|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|217|[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|217|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|225|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|227|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|229|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|231|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|233|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|235|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|237|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|239|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|240|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|242|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|244|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|245|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|343|[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|343|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|363|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|366|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|372|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|375|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|421|[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|421|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|441|[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|441|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|450|[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|450|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|469|[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function |
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|469|[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function |
||=== Build failed: 4 error(s), 72 warning(s) (0 minute(s), 0 second(s)) ===|

 

 

 

is anyone here who can help me compile this code?

 

 

thanks
 

Last Edited: Thu. Oct 26, 2017 - 11:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The code above is written for GCC, it looks like your compiler is Imagecraft, so will need some adjustments for that compiler.

See ICC help for how to use putchar(), also ICC support is fantastic, you should contact them as you have paid for it!

 

Jim

an ICC user!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi...

 

The program was written using the ImageCraft ICCAVR V7.xx C complier.  Code compression was used during compilation of the program. 

I have downloaded the same Compiler as a demo version (64K Code Limit in demo) but it don´t works anyway.

 

I don´t knew whats wrong angry...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My mistake, it is written for ICCAVR, but parts of the code is missing due to the way it was posted. 

You should try contacting the author microcarl via PM, I believe he is still active on the forum and ask him for the code.

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can´t contact him because i can´t find his PM button.... is it possible he deactivate it?

 

sorry for my bad questions but as you can see, i´m new here in the forum...

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Original post in the old forum with undamaged code is here:

http://legacy.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=37891

Stefan Ernst

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The code was posted in a previous incarnation of the forum software. Now #include directives for system header files are presented badly, the actual file specification is missing. You'll see this as directive simply looking like this:

 

#include

The file specs are still there in the forum database of posts, and by doing some tricks with the debugging facilities the correct include can be revealed.

 

In the main file in Carls post:

 

// Standard C library Includes
// Change the following line to iom16v.h or iom32v.h
#include <iom64v.h>
#include <macros.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

 

In "Initialization file StepCon_INIT.c" :

#include <iom64v.h>
#include <macros.h> 

 

For "Modified getchar() function" :

#ifdef __iom16_h
#include <iom16v.h>
  .
  .
#ifdef __iom32_h
#include <iom32v.h>
  .
  .
#ifdef __iom64_h
#include <iom64v.h>

 

and similarly for "Modified putchar() function"

#ifdef __iom16v_h
#include <iom16v.h>
  .
  .
#ifdef __iom32v_h
#include <iom32v.h>
  .
  .
#ifdef __iom64v_h
#include <iom64v.h>

OBSERVE: I am not an ICC user. I have simply dug out the actual code that Carl posted. I can not answer any ICC questions. Hope this helps anyway.

 


 

ki0bk wrote:
You should try contacting the author microcarl via PM

I wouldn't put my hopes up too high on that. We do miss him, but he's not here often nowadays. Last post by Carl here at AVRfreaks was over a year ago..

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have a look at AVR446.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All...

 

Thanks for your help.

 

Ive tested the undemaged code but there are also many errors:

 

in every error line there is the NULL; statement...

 

what´s happend with this statement and how can i solve this error?

 

 

||=== Build: default in test (compiler: ImageCraft AVR Compiler) ===|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|9| extra token "__iom16_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|19| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\getchar.c|29| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|56| extra token "S" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\putchar.c|16| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\putchar.c|31| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\putchar.c|46| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|64| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|104| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|122| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|138| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|142| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|146| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|171| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|202| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|282| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|287| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|292| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|320| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|329| extra token "DEBUG" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|433| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|439| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|445| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|462| extra token "__iom16v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|466| extra token "__iom32v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|470| extra token "__iom64v_h" in preprocessor directive|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|111| invalid initialization type; found `pointer to void' expected `char'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|111| too many initializers|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|141| operands of = have illegal types `unsigned char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|148| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|150| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|151| operands of = have illegal types `unsigned char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|154| undeclared identifier `ESC'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|299| type error in argument 3 to `strtol'; found `pointer to void' expected `int'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|314| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|323| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|332| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|347| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|361| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|371| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|385| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|422| operands of = have illegal types `char' and `pointer to void'|
C:\Dokumente und Einstellungen\Admin\Desktop\test\StepCon.c|425| type error in argument 2 to `memset'; found `pointer to void' expected `int'|
||=== Build failed: 17 error(s), 26 warning(s) (0 minute(s), 0 second(s)) ===|

 

 

 

any ideas?

 

 

 

Thanks

Last Edited: Thu. Oct 26, 2017 - 07:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PM me I can send you a zip file with the corrections needed for ICCAVR v8

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

you have a PM ;-)