Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: tiny2313 pullups

2009-10-01 by blue_eagle74

Once I get everything done I will post a video of the simon says game I am making.

Brian

--- In AVR-Chat@yahoogroups.com, "blue_eagle74" <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
> 			
> 		}
> 	}
> }
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.