It does not need to be exactly at "logic 1". Generally with AVRs,
inputs recognize as logic one is anything that is above 0.6*Vcc (I
think, check the spec sheet).
Jim
On Sep 29, 2009, at 4:20 PM, blue_eagle74 wrote:
> I am trying to use internal pullups on the tiny2313 but only 2 pins
> are actually at a logic one. The are going to a pushbutton switch
> for each of them. I have checked that the switches are open also. I
> set DDRx to 0x00 and PORTx to 0xFF. I even tryed to set the PUD in
> the MCUCR to 0. Is there anything else I have to do? I am using a
> STK-500 with codevision.
>
> Brian
>
> The code is in progress but this is what I have so far:
>
> #include <tiny2313.h>
> #include <delay.h>
>
> int Pause; //Sets the pause time for level
> bit Play = 0; //Sets the play bit for game in progress
> int Seed = 0; //made for random number for display
> int Passes = 0; //limit number of passes to 10
>
> main()
> {
> PORTA = 0x7C;
> PORTB = 0xF4;
> PORTD = 0x04;
>
> DDRA = 0x03;
> DDRB = 0x04;
> DDRD = 0x03;
>
>
> TCCR0A = 0x42;
> TCCR0B = 0x44;
>
> PORTD.0 = 1; // lights light up in series once on reset or start up
> OCR0A = 25;
> delay_ms(250);
> PORTD.0 = 0;
>
> PORTD.1 = 1;
> OCR0A = 50;
> delay_ms(250);
> PORTD.1 = 0;
>
> PORTA.0 = 1;
> OCR0A = 75;
> delay_ms(250);
> PORTA.0 = 0;
>
> PORTA.1 = 1;
> OCR0A = 100;
> delay_ms(250);
> PORTA.1 = 0;
>
> TCCR0A = 0x02;
> PORTB.2 = 0;
>
> while(1)
> {
> while (PIND.6) //Wait for the start button to be pushed
> {
> ;
> }
>
> Play = 1; //Set the play var to true
>
> if (PIND.3) //Check for level and set the delay time for delay
> between display lights
> {
> Pause = 100;
> }
> else if (PIND.4)
> {
> Pause = 200;
> }
> else if (PIND.5)
> {
> Pause = 300;
> }
> else //default if there is none selected to level one
> {
> Pause = 300;
> }
>
>
> while (Play) //start of game play
> {
> Passes = 1; //first pass
>
> }
> }
> }
>
>
>
[Non-text portions of this message have been removed]Message
Re: [AVR-Chat] tiny2313 pullups
2009-09-29 by Jim Wagner
Attachments
- No local attachments were found for this message.