ATM13: Porovnání verzí

Z MediaWiki SPŠ a VOŠ Písek
Skočit na navigaci Skočit na vyhledávání
Bez shrnutí editace
 
(Není zobrazeno 6 mezilehlých verzí od stejného uživatele.)
Řádek 3: Řádek 3:
=== new ===
=== new ===


[[Soubor:ATM13.png|400px]]
[[Soubor:ATM13.png|400px|ATM13]]
[[Soubor:ATM13b_PCB_01.png|400px]]
[[Soubor:ATM13b_PCB_01.png|400px|ATM13]]




Řádek 11: Řádek 11:
[[Soubor:ATM13 bez ISP sch.png|400px]]
[[Soubor:ATM13 bez ISP sch.png|400px]]
[[Soubor:ATM13 bez ISP pcb.png|400px]]
[[Soubor:ATM13 bez ISP pcb.png|400px]]
===Sestava s programátorem [[PRESTO]]===
[[Soubor:ATM13-apl.png|400px]]
<source lang="asm">
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
</source>
<source lang="cpp">
//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);
  }
  }
}
}
</source>

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

ATM13 - Board

new

ATM13 ATM13


old

Sestava s programátorem PRESTO

	 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);
   }
  }
 }
}