Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Simple Press Counter for ATtiny2313
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Simple Press Counter for ATtiny2313

by 1051100720 on Fri Apr 16, 2010 10:11 pm

Dear franklin97355,

I have checked my contrast setting and it appears fine. I think the problem lies more in the codes. :( Or either I'm not burning it properly.
1051100720
 
Posts: 11
Joined: Wed Apr 14, 2010 4:18 am

Re: Simple Press Counter for ATtiny2313

by 1051100720 on Sat Apr 17, 2010 5:37 am

Hello again!!

Just wanted to ask if anyone can share a link to download the util/delay.h header file as it's making my compiler give a lot of warnings.

Thanks!! :P
1051100720
 
Posts: 11
Joined: Wed Apr 14, 2010 4:18 am

Re: Simple Press Counter for ATtiny2313

by uhe on Sat Apr 17, 2010 7:05 am

1051100720 wrote:Just wanted to ask if anyone can share a link to download the util/delay.h header file as it's making my compiler give a lot of warnings.
It's part of the avr-libc. AFAIK it should come together with winavr. So there should be no need to download it again. And again, if you would have shared some error messages someone might be able to help you help you...
Your last screenshot for example shows that you should define F_CPU in your code. Hint: _delay_ms() relies on F_CPU to calculate the correct amount of time to wait.
"I have not failed. I've just found 10,000 ways that won't work." - Thomas Edison
uhe
 
Posts: 178
Joined: Mon Sep 03, 2007 4:50 pm
Location: metric world

Re: Simple Press Counter for ATtiny2313

by 1051100720 on Sat Apr 17, 2010 7:54 am

Dear Uhe,

I have already shared the error messages in that screenshot. That's the only warning that came up. But AVRStudio generated a hew file nonetheless.

uhe wrote:Your last screenshot for example shows that you should define F_CPU in your code. Hint: _delay_ms() relies on F_CPU to calculate the correct amount of time to wait


So that means what is wrong is that F_CPU is not declared? Can I declare it as something like:

"#include <avr/io.h>
#include <util/delay.h>
#define F_CPU 8000000UL"

How is the 8000000UL calculated?

Thank you thank you. :)
1051100720
 
Posts: 11
Joined: Wed Apr 14, 2010 4:18 am

Re: Simple Press Counter for ATtiny2313

by uhe on Sat Apr 17, 2010 9:03 am

You need to define it before you include delay.h so that dalay.h can use it.
Would be nice if someone can shed some light on the UL prefix.

You can find more information about F_CPU here or here or .....
"I have not failed. I've just found 10,000 ways that won't work." - Thomas Edison
uhe
 
Posts: 178
Joined: Mon Sep 03, 2007 4:50 pm
Location: metric world

Re: Simple Press Counter for ATtiny2313

by FazJaxton on Mon Apr 19, 2010 11:17 am

UL at the end of an integer constant tells the compiler to treat the constant as an unsigned long. Otherwise the compiler will try to figure out what type to make the value. It probably doesn't make a difference here, but it also doesn't hurt to be sure.
FazJaxton
 
Posts: 59
Joined: Mon Sep 28, 2009 2:18 pm
Location: Kansas, USA

Re: Simple Press Counter for ATtiny2313

by 1051100720 on Mon Apr 19, 2010 12:33 pm

FazJaxton wrote:UL at the end of an integer constant tells the compiler to treat the constant as an unsigned long. Otherwise the compiler will try to figure out what type to make the value. It probably doesn't make a difference here, but it also doesn't hurt to be sure.


Thanks for the enlightenment!! :D

And thank you to UHE for actively helping me write my codes! I have managed to build it without any errors and warnings! :D
1051100720
 
Posts: 11
Joined: Wed Apr 14, 2010 4:18 am

Re: Simple Press Counter for ATtiny2313

by uhe on Tue Apr 20, 2010 11:00 am

@FazJaxton
Okay good to know thanks. I always used F_CPU without UL and had no problems that I'm aware of :)

@1051100720
Cool! Does the LCD work - are the black squares gone?
"I have not failed. I've just found 10,000 ways that won't work." - Thomas Edison
uhe
 
Posts: 178
Joined: Mon Sep 03, 2007 4:50 pm
Location: metric world

Please be positive and constructive with your questions and comments.


cron