//********************************************************************** char table_io[13] = { 0b00000000, //Led non 0b00000001, //Led 1 0b00000010, //Led 2 0b00000001, //Led 3 0b00010000, //Led 4 0b00000001, //Led 5 0b00100000, //Led 6 0b00000010, //Led 7 0b00010000, //Led 8 0b00000010, //Led 9 0b00100000, //Led 10 0b00010000, //Led 11 0b00100000 //Led 12 }; char table_tris[13] = { 0b00111111, //Led non 0b00111100, //Led 1 0b00111100, //Led 2 0b00101110, //Led 3 0b00101110, //Led 4 0b00011110, //Led 5 0b00011110, //Led 6 0b00101101, //Led 7 0b00101101, //Led 8 0b00011101, //Led 9 0b00011101, //Led 10 0b00001111, //Led 11 0b00001111 //Led 12 }; //********************************************************************** //■■■メイン関数■■■ void main() { int cnt, ad; // OSCCON = 0b01110000; CMCON0 = 0b00000111; ANSEL = 0b00000100; TRISIO = 0b00001001; // for (cnt = 0; cnt <= 12; cnt++) { TRISIO = table_tris[cnt]; GPIO = table_io[cnt]; Delay_ms(100); } // while (1) { ad = Adc_Read(2); ad /= 79; for (cnt = 0; cnt <= ad; cnt++) { TRISIO = table_tris[cnt]; GPIO = table_io[cnt]; Delay_ms(1); } } } //**********************************************************************