ATM13

Z MediaWiki SPŠ a VOŠ Písek
(Rozdíly mezi verzemi)
Přejít na: navigace, hledání
(Sestava s programátorem PRESTO)
 
Řádka 54: Řádka 54:
 
DB 00001000B ;0x0F 9D
 
DB 00001000B ;0x0F 9D
 
END
 
END
 
+
</source>
  
 
<source lang="cpp">
 
<source lang="cpp">
Řádka 68: Řádka 68:
 
int a,b;
 
int a,b;
 
int arr[10]={0x21,0x7D,0x13,0x19,0x4D,0x89,0x81,0x3D,0x01,0x09};
 
int arr[10]={0x21,0x7D,0x13,0x19,0x4D,0x89,0x81,0x3D,0x01,0x09};
 +
 
void main()
 
void main()
 
{
 
{
P2=0x21;
+
P2=0x21;
P0=0x21;
+
P0=0x21;
 
while(1)
 
while(1)
 
{
 
{
P3=0xFF;
+
P3=0xFF;
if(h==0)
+
if(h==0)
{
+
  {
if(n==99&&m==99)
+
if(n==99&&m==99)
{
+
    {
P2=0x67;
+
P2=0xFE;
P0=0x67;
+
P0=0xFE;
}
+
    }
 
else
 
else
{
+
  {
m=m+1;
+
m=m+1;
n=n+1;
+
n=n+1;
a=m/10;
+
a=m/10;
b=n%10;
+
b=n%10;
P2=arr[a];
+
P2=arr[a];
P0=arr[b];
+
P0=arr[b];
 +
 
 
while(h==0);
 
while(h==0);
 +
  }
 
}
 
}
}
+
 
 
if(g==0)
 
if(g==0)
{
+
{
 
if(n==0&&m==0)
 
if(n==0&&m==0)
{
+
    {
P2=0x3F;
+
P2=0x3F;
P0=0x3F;
+
P0=0x3F;
}
+
    }
 
else
 
else
{
+
{
m=m-1;
+
m=m-1;
n=n-1;
+
n=n-1;
a=m/10;
+
a=m/10;
b=n%10;
+
b=n%10;
P2=arr[a];
+
P2=arr[a];
P0=arr[b];
+
P0=arr[b];
 
while(g==0);
 
while(g==0);
}
+
  }
}
+
  }
}
+
}
 
}
 
}
 
</source>
 
</source>

Aktuální verze z 12. 12. 2017, 15:09

ATM13 - Board

new

ATM13 ATM13


old

ATM13 bez ISP sch.png ATM13 bez ISP pcb.png

Sestava s programátorem PRESTO

ATM13-apl.png

	 MOV	DPTR,#TAB	 
 
tens: 	 MOV	P0,#00000010B
	 MOV	R5,#01H			
units:	 MOV	R3,#00H		 
next:	 MOV	A,R3			 
	 MOVC	A,@A+DPTR	 
	 MOV 	P0,A
	 ACALL	delay				 
	 INC	R3				 
	 CJNE	R3,#10D,next
	 MOV	A,R5
	 MOVC	A,@a+dptr
	 MOV	P2,A
	 INC	R5
	 CJNE	R5,#11D,again
	 SJMP	tens
again:	 SJMP	units			 	
 
delay:	MOV	R2,#06D		 
temp2:	MOV	R1,#255D		 
temp1:	MOV	R0,#255D		 
	DJNZ	R0,$         
	DJNZ	R1,temp1		 
	DJNZ	R2,temp2		 
	RET			
 
TAB:	DB 01000010B	;0x02 	0D
	DB 10011111B	;0x9F	1D		
	DB 00100100B	;0x24	2D		
	DB 00001100B	;0x1C	3D		
	DB 10011000B	;0x98	4D
	DB 01001000B	;0x48	5D
	DB 01000000B	;0x40	6D		
	DB 00011110B	;0x1E	7D		
	DB 00000000B	;0x00	8D		
	DB 00001000B	;0x0F	9D					
END
//2 Digit 7-Segment Up Down Counter Project using 8051 Microcontroller
//https://electronicswork.wordpress.com/2012/10/10/2-digit-7-segment-up-down-counter-project-using-8051-microcontroller/
#include <at89x51.h>
 
#define h P3_2	//up counter button 
#define g P3_3	//down counter button
 
int m=0;
int n=0;
int a,b;
int arr[10]={0x21,0x7D,0x13,0x19,0x4D,0x89,0x81,0x3D,0x01,0x09};
 
void main()
{
	P2=0x21;
	P0=0x21;
while(1)
{
	P3=0xFF;
	if(h==0)
  {
	if(n==99&&m==99)
     {
	P2=0xFE;
	P0=0xFE;
     }
else
  {
	m=m+1;
	n=n+1;
	a=m/10;
	b=n%10;
	P2=arr[a];
	P0=arr[b];
 
while(h==0);
  }
}
 
if(g==0)
 {
if(n==0&&m==0)
    {
	P2=0x3F;
	P0=0x3F;
    }
else
 {
	m=m-1;
	n=n-1;
	a=m/10;
	b=n%10;
	P2=arr[a];
	P0=arr[b];
while(g==0);
   }
  }
 }
}
Osobní nástroje
Jmenné prostory
Varianty
Akce
Rychlá navigace
NEJ aktivity
Nejlepší předměty
Nejlepší MCU
SW-HW
Ostatní
Utility
Nástroje
Tisk/export