driver for 8x8
Embed:
(wiki syntax)
Show/hide line numbers
8x8.cpp
00001 #include "8x8.h" 00002 00003 #include "smiles.h" 00004 00005 //define 2 buses for the row and column pins 00006 BusOut Row(PTC11,PTC10,PTC3,PTB10,PTC0,PTE2,PTE3,PTC5); 00007 00008 BusOut Col(PTC7,PTC6,PTB8,PTC4,PTE5,PTB9,PTE4,PTB11); 00009 00010 // sub to write character to the 8x8 display once - has to be repeated to keep display live 00011 int write_8x8(int eye,int mth) 00012 { 00013 int rw,i; 00014 //write eyes 00015 for(i=0; i<4; i++) { 00016 rw=0; 00017 rw=1<<i; 00018 Row=~rw; // this inverts the row code so that only the desired row is low 00019 Col=eyes[i+4*eye]; 00020 wait(0.002); 00021 00022 }//endfori 00023 //write mouth 00024 for(i=4; i<8; i++) { 00025 rw=0; 00026 rw=1<<i; 00027 Row=~rw; // this inverts the row code so that only the desired row is low 00028 Col=mouth[i-4+4*mth]; 00029 wait(0.002); 00030 00031 }//endfori 00032 00033 00034 00035 00036 return(0); 00037 }
Generated on Sat Jul 23 2022 00:05:17 by 1.7.2