matlab-免费使用
话说好久没来了…最近好不容易考完了试, 然后是课设和GRE一起来, 确实没有什么经历在看些编程的东西了= =我感觉GRE要转考才行啊, 现在只有10天了然而感觉没刷什么题目, 光背单词去了, 单词虽然背的差不多了, 但是题目还是很重要的= =.不过360的价格还是可以接受的.
今天在看转考的事情的时候就看了一下数学建模的时间, 结果进了建模的官网让我看到了这个东西..
于是点了进去…
居然可以用半年, 想想那几千的价格..赶紧申请了一个.
72小时嘛= =等等吧
正好学学MATLAB! 感觉julia还是没有matlab好用
然后课设我们做的是个51单片机的出租车计价器, 居然神奇的学会了单片机..感觉挺简单的. 下面是写的代码 300行
#include <stdio.h>
#include <AT89x51.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
int xscode[6] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d};
int zxscode[6] = {0x1f, 0x2f, 0x37, 0x3b, 0x3d, 0x3e};//片选
int codetab[] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f};
int i,j,flag;
uchar sec;
int kk=0;
int count=0;
int jkk=0;
int jflag=0;
int kflag=0;
int zdflag=0;
int kilo=0;
int dj=1;
int djflag=0;
int nflag=0;
int flag_music=0;
bit write=0;
sbit key1 = P1^0;
sbit key2 = P1^1;
sbit key3 = P1^2;
sbit key4 = P1^3;
sbit key5 = P3^4;
sbit SDA=P3^0;
sbit SCL=P3^1;
sbit speaker=P1^4;
unsigned char timer0h,timer0l,time;
code unsigned char sszymmh[]={5,1,1, 5,1,1, 6,1,2, 5,1,2, 1,2,2, 7,1,4,
5,1,1, 5,1,1, 6,1,2, 5,1,2, 2,2,2, 1,2,4,
5,1,1, 5,1,1, 5,2,2, 3,2,2, 1,2,2, 7,1,2, 6,1,2,
4,2,1, 4,2,1, 3,2,2, 1,2,2, 2,2,2, 1,2,4};//祝你生日快乐
code unsigned char FREQH[]={
0xF2,0xF3,0xF5,0xF5,0xF6,0xF7,0xF8,
0xF9,0xF9,0xFA,0xFA,0xFB,0xFB,0xFC,0xFC, //1,2,3,4,5,6,7,8,i
0xFC,0xFD,0xFD,0xFD,0xFD,0xFE,
0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFF,
} ;
code unsigned char FREQL[]={
0x42,0xC1,0x17,0xB6,0xD0,0xD1,0xB6,
0x21,0xE1,0x8C,0xD8,0x68,0xE9,0x5B,0x8F, //1,2,3,4,5,6,7,8,i
0xEE,0x44, 0x6B,0xB4,0xF4,0x2D,
0x47,0x77,0xA2,0xB6,0xDA,0xFA,0x16,
};
void delay_s(unsigned char t)
{
unsigned char t1;
unsigned long t2;
for(t1=0;t1<t;t1++)
{
for(t2=0;t2<8000;t2++)
{
;
}
}
TR0=0;
}
void song()
{
TH0=timer0h;
TL0=timer0l;
TR0=1;
delay_s(time);
}
void play_song(void)
{
unsigned char k,i;
i=0;
while(i<18){
k=sszymmh[i]+7*sszymmh[i+1]-1;
timer0h=FREQH[k];
timer0l=FREQL[k];
time=sszymmh[i+2];
i=i+3;
song();
}
}
void delay(){
;;
}
void delay1(xms){
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
}
void start(){
SDA=1;
SCL=1;
delay();
SDA=0;
delay();
}
void stop(){
SDA=0;
delay();
SCL=1;
delay();
SDA=1;
}
void respons(){
uchar i;
SCL=1;
delay();
while((SDA==1)&&(i<250))
i++;
SCL=0;
delay();
}
void init(){
SDA=1;
delay();
SCL=1;
delay();
}
uchar read_byte(){
uchar i,j;
for(i=0;i<8;i++){
SCL=1;
j<<=1;
j|=SDA;
SCL=0;
}
return j;
}
void write_byte(uchar date){
uchar i,temp;
temp = date;
for(i=0;i<8;i++){
temp<<=1;
SCL=0;
delay();
SDA=CY;
delay();
SCL=1;
delay();
}
SCL=0;
delay();
SDA=1;
delay();
}
void write_data(uchar addr, uchar date){
start();
write_byte(0xa0);
respons();
write_byte(addr);
respons();
write_byte(date);
respons();
stop();
}
uchar read_data(uchar addr){
uchar date;
start();
write_byte(0xa0);
respons();
write_byte(addr);
respons();
start();
write_byte(0xa1);
respons();
date=read_byte();
stop();
return date;
}
void disp(){
for(flag=0;flag<6;flag++){
P0=xscode[flag];
P2=zxscode[flag];
delay1(2);
P0=0;
}
}
void jijia(){
if(kk<=2){
jkk=5;
kk=2;
}
else if(kk>2&&kk<=35){
jkk=5+dj*(kk-2)+1;
}
else if(kk>35&&kk<900){
jkk=5+2*dj*(kk-2)+1;
}
kflag=kk/100;
jflag=jkk/100;
xscode[2]=codetab[kflag];
xscode[5]=codetab[jflag];
kflag=(kk/10)%10;
jflag=(jkk/10)%10;
xscode[1]=codetab[kflag];
xscode[4]=codetab[jflag];
kflag=kk%10;
jflag=jkk%10;
xscode[0]=codetab[kflag];
xscode[3]=codetab[jflag];
}
void disp_time(){
xscode[0]=codetab[2];
xscode[1]=codetab[0];
xscode[2]=codetab[7];
xscode[3]=codetab[0];
xscode[4]=codetab[6];
xscode[5]=codetab[1];
}
void qingling(){
for(i=0;i<=5;i++){
xscode[i]=0x3f;
}
}
void main(){
//init();
//kk=read_data(2);
//if(kk>100)
// kk=0;
kk=0;
EA=1;
ET0=1;
TL0=(65536-50000)%256;
TH0=(65536-50000)/256;
TMOD=0x01;
//ET1=1;
//TL1=(65536-50000)%256;
//TH1=(65536-50000)/256;
//TMOD=0x10;
//TR1=1;
disp_time();
disp();
while(1){
while(key1 == 0){
if(key1==1){
jijia();
flag_music=0;
}else{
if(flag_music == 0){
play_song();
flag_music = 1;
}
jijia();
disp();
if(key2==1){
if(nflag == 0){
nflag++;
kk++;
jijia();
}
}else{
nflag = 0;}
if(key3==0){
qingling();
dj=0;
kk=0;
djflag=0;
nflag = 0;
}
//if(write==1){
// write=0;
// write_data(2,kk);
//}
while(key4==0){
disp_time();
disp();
}
}
disp();
}
if(key3==0){
qingling();
dj=0;
kk=0;
djflag=0;
nflag = 0;
}
disp();
while(key4==0){
disp_time();
disp();
}
}
}
void t0int() interrupt 1 using 0
{
TR0=0;
speaker=!speaker;
TH0=timer0h;
TL0=timer0l;
TR0=1;
}
//void t0(void) interrupt 3 using 1
//{
// TH0=(65536-50000)/256;
// TL0=(65536-50000)%256;
// count++;
// if(count==20)
// {
// count=0;
// write=1;
// }
//}
用keil和proteus进行交互来仿真设计, 最后用AD画出PCB板子, 然后一个电路就完成了..感觉大二刚来的时候还是TOO NAIVE了,这个东西其实不是很难得 = = , 然后是绩点的问题, 这个学期感觉绩点应该有4.2吧, 还是想拿个国奖的, 然后只有2个学期了, 加油, 要开始狂刷绩点了! 最后一年的绩点必须要高点, 这样大三申请的话比较有保障, 而且成绩也是在明显上升的…
好了就这样吧 = = 我现在去把转考的事情弄了..这几天准备下数模和玩下其他的东西吧, 不想搞GRE了…烦人= = 反正还不急.然后刚才复制代码进来的时候貌似直接在pycharm里复制在转成代码块会乱码..用sublime中转了一下就好了