FAQ for the Microcontroller project

What means "Error writing flash" while using the PC-Loader ?
It is a generic serial communication error during programming; you can try re-initializing the USB serial port by unplugging it, or even restart the computer to reset the driver.
Also, it may mean you have a power supply issue, i.e you have less than 5V on the MAX232 of you have a bad supply with a lot of line noise on it. You can use the oscilloscope to look if your RS232 or TTL levels look as they should.
It is unlikely that the Flash has worn out, since it is guaranteed for 10 000 write operations.

What means "Error Accessing COM Port" while using the PC-Loader ?
It means that another program, most likely the Code Vision terminal, is keeping the port busy. You must use the "disconnect" button in the terminal before using the PC-Loader.

Should I also install AVR Studio or Atmel Studio?
No. AVR Studio is only needed if you want to use an external programmer (it provides a driver for it). Atmel Studio is a completely independent software suite.

My board worked fine and now it stopped working
Beside the obvious possibility of a hardware problem, it may also be that your application has been inadvertendly erased from FLASH. Try reloading the .HEX using the PC-Loader, since the bootloader can never be erased (unless you use an external programmer).

I have some input sensors (digital) that function randomly
A common mistake is forgetting to enable the pull-up resistor, in the case the I/O is driven only to ground by the sensor - the same case as with the switch on the main schematic. You must set the bit in the PORTX value to "1" when the corresponding DDRX bit is "0" (input) in order to enable the pull-up.

I have added a LED but it lights extremly dim, almost if it's not lit at all
Similar to above: you may have forgotten to set the direction of the corresponding DDRX bit as output "1". By default, all direction bits are "0" (input). A very weak current may flow thru the pull-up and light the LED.

Can I use delay_ms() for intervals longer than 2s if I also use the watchdog?
Yes, the delay_ms() function internally calls the watchdog reset.

Some functions like printf("%3d") or printf("%2.3f") don't print the expected result
The CVAVR compiler doesn't by default include support for these printf options, in order to reduce the compiled code size. You can override this setting in menu Project -> Configure -> C Compiler (long, float, width and precision for printf and scanf)

During the final session can I be asked questions from the code generated using Code Wizard?
You can receive questions from specific initializations which are essential in your projects, such as: the value and direction of the ports you use (set in the PORTX and DDRX registers), the timer interval and clock source (if used), the voltage reference and the channel for the ADC (if used) etc. It is assumed you understand the initialization of the microcontroller's peripherals that you used. You will not be asked about default registers and values which are not explicitly used by your project (most of these are initialized with 0 by Code Wizard). You will also NOT be asked about the serial initialization code written by Code Wizard.

What's the difference between my board and an Arduino board?
Basically, you have built "your own Arduino", since the Arduino board contains an AVR processor, supply, clock, USB-serial conversion. The only difference is the bootloader/PC Loader pair and the compiler (I prefer the CVAVR compiler which is standard (ANSI) C, unlike the Arduino compiler which is non-standard).
Any "shield" which is made for the Arduino can be used on your board, however, you don't need to purchase the whole "shield", you can solder the sensor or add-on component directly on your board.

Am I obliged to spend my own money for buying aditional parts?
No you are not. Some of the specific projects need aditional components which are not available in the lab; usually, they cost less than 10 Euro, and since we give you for free the PCB and all the components for the common part, it makes sense to buy yourself any other parts needed for your own board, since you will keep it after the end of the project.
If you really don't want to buy anything, please read carefully the projects specifications, and only select projects which require no additional parts, or parts which are available for free in the lab (LEDs, transistors, discrete components, switches etc). Ask me for the availability of certain parts, if unsure.

I want to buy parts, where can I do this in Bucharest?
The "electronics street" in Bucharest is called "Maica Domnului" and you can find it on Google Maps. There are more than 5 stores on that street. I suggest you team with at least a Romanian colleague and go as a group, since some shop assistants may not know enough English, and also public transport drivers are not English speaking. Also, be prepared to ask for specific parts, don't expect to ask for "a 1A PNP transistor" and hope you will be advised in the shop.
Alternatively if you have a mailing (postal) address you can order online: for short delivery I suggest www.tme.ro, for longer deliveries (1 month, sometimes longer) but dirt cheap prices I recommend www.aliexpress.com (in China).