Page 141 - MDP2020-2
P. 141

················································································  명장양성프로젝트  【MDP】  과제발표회  자료집  Ⅱ    |  135



                            //moter();
                    }
            }


            void  shift_water()
            {
                    int  i;
                    unsigned  long  shift=0x0000000f;

                    for(i=0;  i<31;  i++)
                    {
                            for(j=0;  j<100;  j++)
                            {
                                    PORTA=shift&0xff;
                                    PORTB=(shift>>8)&0xff;
                                    PORTC=(shift>>16)&0xff;
                                    PORTD=(shift>>24)&0xff;
                            }
                    }

                    PORTA=0x00;
                    PORTB=0x00;
                    PORTC=0x00;
                    PORTD=0x00;
                    delay_ms(10);
            }


            void  print(unsigned  long  shape[32])
            {
                    int  i;
                    int  delay_value[]={13,13,13,13,13,13,13,13,13,13,13,
                                                            15,15,15,15,15,15,15,15,15,15,
                                                            17,17,17,17,17,17,17,17,
                                                            20,20,20,20};
                    for(i=31;i>=0;i--)
                    {
                            PORTA=shape[i]&0xff;
                            PORTB=(shape[i]>>8)&0xff;
                            PORTC=(shape[i]>>16)&0xff;
                            PORTD=(shape[i]>>24)&0xff;
                            delay_ms(delay_value[31-i]);
                    }

                    PORTA=0x00;
                    PORTB=0x00;
   136   137   138   139   140   141   142   143   144   145   146