'************************************************************ '* Projet - Emeteur Recepteur - Groupe 2 - TS-3 * 2003/2004 * '************************************************************ '* BESNARD Romain * '* BOURSE Cedric * '* HENAFF Ivan * '********************************************************* '* Programmation par Orion_ [2003] (a.k.a Cedric BOURSE) * '********************************************************* '* Programme Basic 11 pour la base, Version alpha. * '*************************************************** // RECEPTEUR - POSTE SI5 #include "startrf1.bas" ' DDRA=255 ' PORTA EN SORTIE byte t2,t,a byte value int n1,n2,n3,n4 #define UNLOGIQUE 90 // 0000000001111111 // 1234567890123456 ' Boucle principale do n1=0 n2=0 n3=0 n4=0 do loop until PORTE.1=0 do loop until PORTE.1=1 do n1=n1+1 loop until PORTE.1=0 do n2=n2+1 loop until PORTE.3=0 do n3=n3+1 loop until PORTE.4=0 do n4=n4+1 loop until PORTE.5=0 value=0 if n1>UNLOGIQUE then value=value+1 end if if n2>UNLOGIQUE then value=value+2 end if if n3>UNLOGIQUE then value=value+4 end if if n4>UNLOGIQUE then value=value+8 end if print "#1 value=",value PORTA=value loop '****************************************************************************** '******************************* CUSTOM DELAY ******************************** function delaims1(t1) ' pour tempo < 2ms for t = 1 to t1 for t2 = 1 to 4 next t2 next t end function function delaims2(t1) ' pour tempo > 2ms for t = 1 to t1 for t2 = 1 to 5 next t2 next t end function '******************************* lcd ***************************************** #define LCDLINES 2 // lignes/afficheur: 1,2,3,4 #define LCDCOLS 16 // caracters par lignes 16,20 #define LCDBUFSZ (LCDLINES * LCDCOLS) byte lcdbuf(LCDBUFSZ) byte lcdbufpp byte lcdbufppmax // #0 #1 #2 byte code_lcdpos()=00,00,16 // pos de ligne dans la mémoire LCD byte code_lcdmax()=31,15,31 // max pos de ligne dans la mém LCD function lcdputc(byte_c) LCDCON = byte_c lcdtempo() end function byte lcd_pos function putchar(lcdc) byte put_x if (lcdc==`#`) then lcdbufpp=255 return end if if (lcdbufpp=255) then put_x = lcdc AND 7 lcdbufpp = code_lcdpos(put_x) lcdbufppmax = code_lcdmax(put_x) for lcdc=lcdbufpp to lcdbufppmax lcdbuf(lcdc) = ` ` next lcdc goto sendnow; end if if (lcdbufpp>lcdbufppmax) then return; end if lcdbuf(lcdbufpp) = lcdc lcdbufpp = lcdbufpp+1 sendnow: sendlcdbuf() end function function sendlcdbuf() byte d lcdputc(0x80) for d=0 to LCDBUFSZ-1 if d = (LCDBUFSZ/2) then lcdputc(0x80 + 0x28) end if LCDDAT = lcdbuf(d) next d end function function lcdtempo() int tempo_cnt for tempo_cnt=0 to 99 next end function