AVR Code to Arduino

Somebody please help,

i make an oxygen analyzer, they put reference code in the subject but in avr code, could you help me to convert the code

big thanks.

WBO-1.2.zip (67.8 KB)

There is a reference to Waltech in the source files. Do you represent that company?

thanks for reply.

no, i got the code from the waltech site. its open source. i make oxygen analyzer for my project.

The source code is released here under the The MIT License (MIT)

Copyright (c) 2102 Karl Walter

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Good enough for me. Carry on.

[quote author=Coding Badly link=msg=3293102 date=1496895866]
Good enough for me. Carry on.

(y)

  • Create a new directory, say "WBO"
  • Move all of the .c and .h files from the zip file into that directory.
  • Rename main.c to WBO.ino (this should match the directory name that you chose.)
  • Rename all the .c files to .cpp.
  • While (not working)
  • Try to Verify.
  • fix the bugs that are reported, replacing primitive functions with arduino functions when possible.
  • (end of "while.")
  • Decide how much you want to convert to arduino-style...
  • Profit!

The first thing I noticed is that this code is written for an older chip; probably an ATmega8 (because if you try to compile it for an Uno (atmega328) you immediately start getting errors about UART symbols like UCRSB that existed on an ATmega8, but are called things like UCSRB0 on a 328. Compilation actually finishes if you set the board type to an "NG or older" with ATmega8 (but link fails...) I'd replace all that uart code with calls to the Arduino Serial functions, anyway (which means you should rename the main() function to setup() so that you get the arduino initialization as well.
Step (6) is important - let the compiler tell you where the problems are. And the loop; just keep smashing away at it till it works. If you wind up with specific questions, feel free to ask them.

Thank you,

i follow each step but i lack of knowledge about serial function.
do you have any reference for this problem?

https://www.arduino.cc/en/reference/serial