// | ~ & µ $ ##include <reg552.h>
code unsigned char funkce_F[16] = {0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01, 0x00,0x01,0x00,0x01,0x01,0x01,0x00,0x01};
int main()
{
unsigned char vstup;
while(1)
{
vstup = P1;
//if (funkce_F[vstup]==1) P1|=0x04; else P1 &= ~0x04;
if (*(funkce_F+vstup)==1) P1|=0x04; else P1 &= ~0x04;
}
}
*.LST
; FUNCTION main (BEGIN)
; SOURCE LINE # 6
; SOURCE LINE # 7
0000 ?C0001:
; SOURCE LINE # 9
; SOURCE LINE # 10
; SOURCE LINE # 11
0000 E590 MOV A,P1
0002 C4 SWAP A
0003 540F ANL A,#0FH
0005 FF MOV R7,A
;---- Variable 'vstup' assigned to Register 'R7' ----
; SOURCE LINE # 13
0006 900000 R MOV DPTR,#funkce_F
0009 93 MOVC A,@A+DPTR
000A B40105 CJNE A,#01H,?C0003
000D 439004 ORL P1,#04H
0010 80EE SJMP ?C0001
0012 ?C0003:
0012 5390FB ANL P1,#0FBH
; SOURCE LINE # 14
0015 80E9 SJMP ?C0001
; FUNCTION main (END)
#include <REG552.h>
sbit F = P1^2;
unsigned char vysledek = 0,soucin1,soucin2,pomoc;
unsigned char vstup = 0;
unsigned char X,Y,Z,K;
void main()
{
while(1)
{
vstup = P1;
X = (vstup>>4)&0x1;
Y = (vstup>>5)&0x1;
Z = (vstup>>6)&0x1;
K = (vstup>>7)&0x1;
if ((X&Y)|(K&X)|((~Y)&Z&K)) F = 1;
else F = 0;
}
}
Žádné komentáře:
Okomentovat