vincer's profilevincer's moodPhotosBlogListsMore ![]() | Help |
|
|
vincer's moodIt‘s difficult but not impossible! December 31 08小结有惊无险混到了2008年的最后一天。
08总体来说还是不错的,快乐与痛苦并存,还算过得充实。
最过瘾的就是上半年跟silence、peace、vit、hh、yinstone打dota了。
打真三,hh说菜鸟来到先用马岱,不爽转战dota,其乐无比。
N场下来筋疲力尽,过度兴奋。
静下来,大家发现宿舍风扇的响声居然很像dota的片头音乐!
期末,两个实验室聚大餐之后就各奔东西了。
怀念...
来到sz还不错,参加的活动居然比学校多,打篮球、羽毛球,爬山,运动会...
认定了就不要回头,follow your heart
最后,祝各位朋友在新的一年身体健康!惊喜不断!
^_^
January 08 ccup工具使用篇工欲善其事,必先利其器。
1. avr编译仿真工具:
前期:avrstudio+winavr(NP),编译用NP,仿真用avrstudio,makefile设置灵活,不过前提是对makefile文件熟悉。
后期:AVR GCC,跟上面一个样(集成版),设置makefile方便,对makefile熟知度要求相对低。
其实一个样(gcc),差别在于是否集成。
2. 串口调试工具: Serial Port Monitor-强烈推荐,串口监视器,有四种文本模式选择,串口通信收发数据全部可以截取。(得益于这个软件,进度加速)
AccessPort-比超级终端强多了,传输数据少时用它的监视功能还是挺不错的。
3. Avr下载工具: PonyProg2000: 下载速度较慢,支持器件较多;而且下载时cpu几乎都是100%。
DownloadMcu-晓奇工作室: 下载速度较快,支持器件有限,常用的avr芯片都支持就足够了,最好的就是设置熔丝位时有相应的提示。 ccup小结
本来早就应该写的。
可行性:Mega128处理图像(主要是图像格式及大小转换)能否胜任的问题,是否要借助fpga/cpld加以实现?-_-# —> ^_^
1. Gprs模块:TR800相关数据手册, 注意ATE0这个命令(让我郁闷了一阵),此后决定认真的重读数据手册。
2. Xmodem通信协议(已写)。
3. Spi总线:XF-S4240语音芯片的通信方式有I2C,SPI,UART,选用SPI。 设置如下:atmega128- SPI初始化时,将PORTB的MOSI、SCLK和SS引脚作为输出,同时将MISO作为输入引脚,并打开上拉电阻,设置主机模式,高位优先,数据速率f/ 16。 SPI的寄存器进行初始化设置时,应注意以下几点:
4. Usart:由于数据量比较大,误差累积将导致后面的数据出错,故用无误差的晶振频率(试过用16Mhz,但往往是只有前面的一小部分数据正确,往后的数据都出错,改用11.0592后没有发生过数据出错问题,出错就重传);中断+数据缓存区(FIFO),若直接对buffer操作,则注意先把index置零。
5. 全彩Led屏通信协议:由于屏只有windows下的开发dll,肯定不能用在atmega128上了,屏提供的windows程序与Led屏的通信用serialport分析得到通信协议格式。
6. 摄像头通信协议:使用的是zm460,RS232接口,相当郁闷的是数据手册是有误的,只能设定被动模式,而且波特率不能改动,加上指令格式有些错误,庆幸的是有串口监控。
7. 串口硬件设计:公、母串口要配备好,弄清串口线需要交叉还是直通,gprs模块要求硬件流控制信号(rts&cts),不用则将其屏蔽掉(7-8短接),否则不能通信。
8. 红外探头:测试后,红外探头没有描述的灵敏,没办法,只能把红外检测程序考虑完善(就利用这个不灵敏的特点),经调试最后得到很好的稳定性。
9. 图像转换:jpeg->xmp
10. 硬件的布局及布线: 布线要合理,不要跳线太多,做pcb布线的话还是好好的学习一下其相关理论。 后期正式做板时,由于硬件布线不好,程序经常跑飞,那种心情叫无奈。 提高硬件可靠性的考虑: 硬件- .大面积铺地(网格); .晶振用地围住; .每个IC的VCC加上一个0.1uF的电容。 .外围设备控制光耦隔离 软件-
由于没有JTAG仿真器,程序的调试都是用串口回传数据,在适当的地方设置把裸机上的数据回传同样起到仿真器的效果。 xmodem protocolXmodem通信协议: 协议的细节这里不涉及,只说明一下编程注意的事项。数据包有两种:128bytes和1024bytes,tr800模块只支持128bytes。没有采用校验和,而是采用CRC(CCITT)校验。由于RAM有限及通信特性,Uart接收采用FIFO结构。 协议格式: <SOH><blk
#><255-blk #><--128 data bytes--><CRC hi><CRC lo> Flow Diagram SENDER RECEIVER Program Tips: *
When the receiver wishes to <nak>, it should call a "PURGE" subroutine,
to wait for the line to clear. Recall
the sender tosses any characters in its UART buffer immediately upon completing
sending a block, to ensure no glitches were mis-interpreted. * The most common technique is for "PURGE" to call the character receive subroutine, specifying a 1-second timeout,and looping back to PURGE until a timeout occurs. The <nak> is then sent, ensuring the other end will see it.(关键:实现PURGE-字符接收子程序设定1s超时) *
You may wish to add code recommended by John Mahr to your character receive
routine - to set an error flag if the UART shows framing error, or
overrun. This will help catch a few more
glitches - the most common of which is a hit in the high bits of the byte in
two consecutive bytes. The <cksum>
comes out OK since counting in 1-byte produces the same result of adding 80H +
80H as with adding 00H + 00H. key:协议的流程、时间次数控制、出错处理。 January 07 avr-gcc笔记1-data structure in ram
前言:把前段时间做的事情总结一下。
DATA STRUCTURE IN RAM Many of the devices that are possible targets of avr-libc have a minimal amount of RAM. The smallest parts supported by the C environment come with 128 bytes of RAM. This needs to be shared between initialized and uninitialized variables (sections .data and .bss), the dynamic memory allocator, and the stack that is used for calling subroutines and storing local (automatic) variables. Also, unlike larger architectures, there is no hardware-supported memory management which could help in separating the mentioned RAM regions from being overwritten by each other. The standard RAM layout is to place .data variables first, from the beginning of the internal RAM, followed by .bss. The stack is started from the top of internal RAM, growing downwards. The so-called "heap" available for the dynamic memory allocator will be placed beyond the end of .bss. Thus, there's no risk that dynamic memory will ever collide with the RAM variables (unless there were bugs in the implementation of the allocator). There is still a risk that the heap and stack could collide if there are large requirements for either dynamic memory or stack space. The former can even happen if the allocations aren't all that large but dynamic memory allocations get fragmented over time such that new requests don't quite fit into the "holes" of previously freed regions. Large stack space requirements can arise in a C function containing large and/or numerous local variables or when recursively calling function. avr-gcc的栈由内部RAM的顶部向下生长,这样就潜在两个危险性:一是动态分配的堆和栈有可能互相覆盖;二是.data &.bss的数据过多和栈数据覆盖。实际上以上两个问题都发生了,图像数据10Kbytes左右,处理时所需空间大概30多Kbytes(动态+静态)。小插曲1:当时由于LED彩屏的中间位置图像发生奇变才注意到这个问题-_-! Note: The pictures shown in this document represent typical situations where the RAM locations refer to an ATmega128. The memory addresses used are not displayed in a linear scale.
RAM map of a device with internal RAM On a simple device like a microcontroller it is a challenge to implement a dynamic memory allocator that is simple enough so the code size requirements will remain low, yet powerful enough to avoid unnecessary memory fragmentation and to get it all done with reasonably few CPU cycles. Microcontrollers are often low on space and also run at much lower speeds than the typical PC these days. The memory allocator implemented in avr-libc tries to cope with all of these constraints, and offers some tuning options that can be used if there are more resources available than in the default configuration. Internal vs. external RAMObviously, the constraints are much harder to satisfy in the default configuration where only internal RAM is available. Extreme care must be taken to avoid a stack-heap collision, both by making sure functions aren't nesting too deeply, and don't require too much stack space for local variables, as well as by being cautious with allocating too much dynamic memory. If external RAM is available, it is strongly recommended to move the heap into the external RAM, regardless of whether or not the variables from the .data and .bss sections are also going to be located there. The stack should always be kept in internal RAM. Some devices even require this, and in general, internal RAM can be accessed faster since no extra wait states are required. When using dynamic memory allocation and stack and heap are separated in distinct memory areas, this is the safest way to avoid a stack-heap collision. Tunables for malloc()There are a number of variables that can be tuned to adapt the behavior of malloc() to the expected requirements and constraints of the application. Any changes to these tunables should be made before the very first call to malloc(). Note that some library functions might also use dynamic memory (notably those from the <stdio.h>: Standard IO facilities), so make sure the changes will be done early enough in the startup sequence. The variables If the heap is going to be moved to external RAM, The following example shows a linker command to relocate the entire .data and .bss segments, and the heap to location 0x1100 in external RAM. The heap will extend up to address 0xffff. avr-gcc ... -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff ...
实际上如果你使用avrstudio内嵌gcc的话只要在Project->Configuration Options->Memmory中通过Add,选择Sram,在Name输入.data,Address输入0x801100即可,你也通过这个功能可方便移动自定义的数据或是默认的数据区。小插曲2:不知道是不是版本的原因,根据上面的方法在低版本(具体那个版本忘了,建议下载最新版)设置,完全没有效果,结果可以在编译信息或者看map文件,map文件很清晰的给出编译后数据的存放位置。如果你使用外部makefile或者是在PN下编译的话,你可以通过修改makefile中的Linker Options下的内容,如下所示: #---------------- Linker Options ---------------- # -Wl,...: tell GCC to pass this to linker. # -Map: create map file # --cref: add cross reference to map file LDFLAGS = -Wl,-Map=$(TARGET).map,--cref LDFLAGS += $(EXTMEMOPTS) LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) LDFLAGS += -Wl,--section-start=.data=0x801100 #加上上面这个语句即可以,当然上面的其他设置的关键参数也需要修改
小插曲3:把PN编译后的文件都删除时,再次编译时发现没有生成文件,有bug?关闭再打开又可以编译生成文件,但再次删除编译生成的文件时->再编译->仍旧没文件生成->bug,PN version v.2.0.7.667。
Note: See explanation for offset 0x800000. See the chapter about using gcc for the
Internal RAM: stack only, external RAM: variables and heap If dynamic memory should be placed in external RAM, while keeping the variables in internal RAM, something like the following could be used. Note that for demonstration purposes, the assignment of the various regions has not been made adjacent in this example, so there are "holes" below and above the heap in external RAM that remain completely unaccessible by regular variables or dynamic memory allocations (shown in light bisque color in the picture below). avr-gcc ... -Wl,--defsym=__heap_start=0x802000,--defsym=__heap_end=0x803fff ...
Internal RAM: variables and stack, external RAM: heap If The default value of contd…… December 27 随笔很久没来这里了,发现livespace风格还是不错的,至少没什么ad。
想早点出去工作,工作的同学都说压力大。
明天开始常到lab去,浮躁的心,应静下来踏实的做事情。
准备一本技术日记,记下每天学的或想的,心情日记就来这里了。
读研可能后悔三年,不读研可能后悔一辈子。
记得刚开始时心情真的很down,现在还是有所收获的。
不要遇到不顺的事情就埋怨,努力的改变自己。
以后就混合着写了,e文太烂了^_^
February 16 broadcast yourselfThree months ago,I read a message about youtube from one newspaper.Its main meaning is the cover of Time in 2007 is you!Youtube? I have never heard about it.What's it?At that time,I immediately wrote it down for lest I forgot it after a sudden curious.Then,after watched several funny videos,I signed up a account.The address of my own webpage in youtube is http://www.youtube.com/profile?user=mhz54. But there is no any videos in my account now.Surely,I will upload some funny videos later. February 06 prison breakEveryweek I was excited for the Tuesday to come in during the period of preparing for the MA candidate's examination.And now it is the same experience for me.However,the feelings are absolutely different for the nervous now are rather relaxed.Okay,let's come back to the subject.The TV show Prison Break.Only a few words to describe Prison Break.Fantastic?Nervous?Or beyond description?At the beginning, I didn't care about the story I felt like it was kind of stupid to break into prison to break someone out. Nonetheless I gave it a try and I was blown away by the acting, the directing and the writing. So,every night after a 1600 meters'running ,I sat down in front of my moniter to watch Prison Break.(My classmate had downloaded it (every epsiode),indeed he is more crazy,exactly speaking,all of my college classmate.^_^)The episodes are so exciting all the time that I scream almost every time(maybe a bit exaggeration) one episode is over and I have to wait another week.
One of the most impression person for me :Michael Scofield THEN Lincoln Burrows T-bag! I'm backAfter half a year's painstaking work,the MA candidate's examination is finally over.These days which i do my best
to achieve my goal are valuable and worth remmbering.I'm back.But what about next step?
Depend on the result,which will be published about the early of March,I will take my action that i've made.
Indeed,i've getting ready for the coming final exam.No matter what the result will be ,i am preparing for it.
no one will just wait the things happen.During the vacation ,i plan to study toefl ibt course and revise two subject of my major.
Of course,it is Spring Festival!Every day will be fantastic.
I hope all of my family,relations,and my friends will enjoy themself in the coming year.
Happy pig's year.^_^ December 16 How to Read a Datasheet(major English)In order to use a PIC microcontroller, a flip-flop, a photodetector, or practically any electronic device, you need to consult a datasheet. This is the document that the manufacturer provides telling you • the typical device performance • minimum and maximum requirements and characteristics • what you can do to the device without harming it • suggested uses and hints Manufacturers want you, the designer, to have a successful experience with their device. They are trying to be helpful. They don’t always succeed. The datasheet on the following pages is a relatively good datasheet. It tries to concisely tell you everything you need to know about the device, a common 555 timer chip (the duct-tape of the electronics hobbyist). Most datasheets for ICs follow the same general layout. You don’t have to understand everything in a datasheet. There’s a lot of information that might not be of any use to you. The annotations that follow try to point out parts of the datasheet that you should pay particular attention to. Where do you find datasheets? Nowadays you can find almost any datasheet on the internet, often in PDF (Acrobat) form. For example, the LM555 datasheet from National Semiconductor is on their website at www.national.com. October 07 do moreNational Day had gone. Everything will be normalization. Do more say less. Life can sure throw a good curve ball when you least expect it. So make a little progress each day. And you will make a different.
September 19 Love at first sightThought that I was going crazy
Just having one of those days yeah
Didn't know what to do
Then there was you
And everything went from wrong to right
And the stars came out and filled up the sky
The music you were plalying really blew my mind
It was love at first sight
Cause baby when I heard you
For the first time I knew
We were meant to be one
Was tired of running out of luck
Thinking 'bout giving up yeah
Didn't know what to do
Then there was you
---by Kylie Minogue September 13 my five foiblesSeptember 08 get rightTwo weeks for cource design of electronic circuit of low frequent was over.
I will get right next week.
haha,finally I can ……WON'T LET YOU KNOW! August 25 A visit to dentistTomorrow I will go to see a dentist.
Maybe the environment I grew up.ah...
I never realize the importance of teeth.
Laughter makes a difference,espcially with a white and regular teeth.
Something absolute,I think.
The ad supported by Crest is also very funny.
^_^
August 23 Think of you In the morning
when the sun
is just starting to light the day
I am awakened
and my first thoughts are of you
At night
I stare at the dark trees
Silhouetted against the quiet stars
I am entranced into a complete peacefulness
and my last thoughts are of you August 20 long time no see !Hello! Everyone!
Long time no see! How I miss you! Sickening? Aha,so do I!
This term will begin in a week. How I should spend my time this semester?
After all,it is half of college life.
As a beginer of junior,maybe I should make a full plan and take it regularly.
Unfortunately, everytime the plan I have made won't be carried out!
Perhaps a little exaggerated!?
There is no doubt that this time I do the same thing?!
Have a fun! It's hard to say! Lack of confidence?
"Another topic,please! sir. "
"OK! Madam,as you wish!"
See you later!
Oh!I have forgot it.Here,wish my uncle and lovely niece enjoy themselves!
August 13 somewhat troubleI haven't study for a long time.Now I feel some trouble.I am very lazy.
I always have some excuses for it.
Wake up!!! Vincer July 22 come back then go to gzI should stay at school for a week.Unlooked-for a thing.
Instead,I will go to gz for about a week.Really,I don't expect.
But,in my heart I want to.Tomorrow I am going to meet my uncle and
lovely niece.I think it must be rejoiced.To be continue----,not ending------ July 19 go back homeIt's very hot these days.I can’t even put in words to describe how hot it is.
Difficult to bear!!!!
So hot this time.You can image what my present statue is.
Not due to the hot weather.
Aha,a little maybe.
I intend to stay at home just two days.Not because I hate,just some trubles.
Truely,I love my family very much.
Two days later,I will come back.
July 15 my plan in this summerThis summer I have lots of things to do.
But I don't know how I can arrange the calendar.
On July 20th,I will go home and stay two days
then I will come back to school.
C#.net,electronic,mathematica modeling,the list above is my mission.
Yet,I couldn't sure that whether I can manage them well.
One thing that I can certain is at least I can manage one of them.
It is incredible for me to master all of them.
Later,I will contact with teacher L and consult on him with several
question.To be continue if new ideas come out. |
|
||||||
|
|