亚洲一区二区欧美_亚洲丝袜一区_99re亚洲国产精品_日韩亚洲一区二区

Easy-Downloader V1.1 with SDCC

2016-07-05 15:37

Easy-Downloader V1.1 with SDCC 
     I am very happy to use sdcc for writing firmware of my project. The compiled code is very compact and nice. After I succeeded writing a new firmware of xtimer and Easy-downloader V1.1 with sdcc. I cannot stop preparing a new page that gives the idea how to use sdcc and of course it's time to renovate my old project with orcad. For now I can design the hardware, draw a schematic, write the firmware and layout the pcb. So I think why shouldn't begin with Easy-Downloader. Since the programmer board will enable learning and developing the small project with a cheap 20-pin MCU easily.
 

Easy-Downloader V1.1 with SDCC

 

Figure 1: Complete hardware schematic of Easy-Downloader V1.1 ( see errata below).
easy1_3.pdf
 

Hardware
 

The hardware has a bit change at rs232 level converter. Now the circuit uses a popular rs232 level converter, MAX232. Also I cut the bridge diode at the DC input, now I use only one diode to prevent wrong polarity of a given DC adapter.
 

Layout
 

The pcb layout was made with orcad Layout Plus. The gerber file is available at download section below. Here I like to show how nice it is. The top and bottom layers are shown in Figure 2 and Figure 3. Figure 4 shows the component placement layout.
 

Easy-Downloader V1.1 with SDCC
 

Figure 2: Top layer pcb x2 size.
 

Easy-Downloader V1.1 with SDCC
 

Figure 3: Bottom layer pcb x2 size.
 
 

Easy-Downloader V1.1 with SDCC
 
 

Figure 4: Component placment layout.
 

Bill Of Materials
 

The component list is shown in Figure 5. U1 the master chip must be programmed with writer1.hex before the programmer board can run properly. Q2 and Q3 are TO92 plastic package! With a CAN package, pin positions may differ on the layout. You can use any small signal transistors to replace them. VB1 is male type!  All resistors can be 1/4W or 1/8W 5%.
 

Bill Of Materials        January 4,2004      10:44:35 Page1

Item Quantity Reference Part
______________________________________________
 

1 2 C1,C2 30pF disceramic
2 2 C8,C3 10uF 16V electrolytic
3 1 C4 10uF 10V electrolytic
4 5 C5,C6,C7,C12,C13 10uF electrolytic
5 1 C9 470uF 25V electrolytic
6 2 C10,C11 0.1uF multilayer
7 2 C14,C15 0.1uF multilayer
8 1 D1 POWER small red LED for power indicator
9 1 D2 1N4007 silicon rectifier diode
10 1 J1 DC jack 
11 1 Q1 11.0592MHz low profile crystal
12 1 Q2 2N2907 PNP small signal transistor
13 1 Q3 2N2222A NPN small signal transistor
14 5 R1,R3,R6,R10,R11 10K
15 1 R2 250
16 1 R4 1150
17 1 R5 2150
18 1 R7 4.7k
19 1 R8 1k
20 1 R9 2k
21 1 U1 AT89C2051 20-pin DIP Microcontroller with 2kB Flash
22 1 U2 74LS373 D-type FF
23 1 U3 20-pin ZIF (Zero-Insertion-Force) socket
24 1 U4 LM317/TO adjustable regulator
25 1 U5 MAX232A 16-pin DIP RS232 level converter
26 1 U6 LM7805/TO fix +5V voltage regulator
27 1 VB1 SUB-D 9 (male) for NULL CABLE    DB9 connector
 


 

Figure 5: Component list.
 

Software
 

sdcc has the header file that declares bit variables and we can use them in program directly. We can define the specified bits as below,
 


#define LM317 P3_5
#define LE P3_7
#define prog P3_2
#define rdy P3_3
#define xtal P3_4
#define p10 P1_0
#define p11 P1_1
#define p12 P1_2
#define p13 P1_3
#define p14 P1_4

 
In c program, we can use assignment statement to set or clear them directly. For instance, function that makes low to high transition at P3.2,
 

pulseProg()
{
 prog = 0;
 prog = 0;
 prog = 0;
 prog = 1;
}
The ASCII strings were defined with modifier, 'code', so the compiled code will place them in code memory space.

char code title[] = '\n\r Easy-Downloader V1.3 for ATMEL 89C2051/4051 (sdcc version)';
char code prompt[] = '\n\r >';
char code ok[] = '\n\r ok';
 

I have built function that print string to terminal, to make it compatible with the old version with Micro-C. Look at the source cod here,
 


putstr(char *s)
{
 char i=0;
 char c;
 while((c=*(s+(i++)))!= 0) putchar(c); // while byte is not terminator, keep sending
}

 
The pointer s points to the start address of string. It will send character to serial port with function putchar while the character is not the terminator byte!

Sdcc has no putchar( ) function, so we must build it before we can use. I wrote a simple putchar( ) as my assembly code.
 

void putchar(char c)
{
 while(!TI); 
 TI=0;
 SBUF = c;
}

 
We test TI bit before we can write a byte to SBUF. While TI is not set (buffer is not free) keep polling it, when it set, clear it and write a byte to SUF.

The same as putchar( ) function, I had built the getchar( ) for this board to make it compatible with old version.
 

char getchar(void)
{
 char c;
 while(!RI);
 RI =0;
 c = SBUF;
 putchar(c);    // echo to terminal
 return SBUF;
}

 
Now the code polls the RI bit, when it set, clear it and read SBUF and simply echo the received character with putchar( ) function.

The important function is getnum ( ) function. Let me explain how it works?
 

unsigned int getnum()
{
    char s[6]; 
    char c;
    char i;
    unsigned int temp16; 
 c = 0;
 i=0;
  for (i = 0; c != 0xa; i++) // loop until CR has entered
    { 
        putchar(xon); // send xon to signal host to send byte
        c = getchar(); // get character from serial port
  if(c == 0xd) c=0xa; // convert CR to LF to make it compatible with ez31 and ez41
        s[i] = c; // save character to array
    }
    s[i-1] = 0; // put terminator at the end of string

// convert ascii to integer (atoi(s))
  temp16 = 0;
 for(i=0; s[i] != 0; i++) temp16 = 10*temp16 + s[i]-'0';
    return temp16; // return 16-bit for number of byte counting
}
 


 
Look at the red one, it is a simple for loop with condition to check the received character is NEWLINE or not. If not it will save the character being received to array s[i]. The putchar(xon) sends the xon to host to let it know the board is ready to receive a byte. The getchar( ) is not echo the received byte. However it converts CF to LF. When the loop found LF or 0xa, it will exit from the for loop and save terminator byte to s[i-1].

The ascii string that saved in array s[] will be converted to 16-bit number with atoi code.
 

Most of the high level code are the same as previous version with Micro-C. You may study them in the source code then.
 

Let me shows you how to use sdcc to compile the source code again. The sample below uses batch file, s.bat.
 

C:\sdcc\app>s

C:\sdcc\app>path=c:\sdcc\bin
 

C:\sdcc\app>sdcc writer1.c
 

library file /sdcc/share/sdcc/lib/small/libsdcc.lib
library file /sdcc/share/sdcc/lib/small/libint.lib
library file /sdcc/share/sdcc/lib/small/liblong.lib
library file /sdcc/share/sdcc/lib/small/libfloat.lib
 

C:\sdcc\app>packihx writer1.ihx>writer1.hex
packihx: read 166 lines, wrote 75: OK.
 

C:\sdcc\app>
 


 
The batch file s.bat contains,

path=c:\sdcc\bin
sdcc writer1.c
packihx writer1.ihx>writer1.hex
 

The output machine code is hex file with *.ihx extension. We can use a tool, packihx to convert such hex file with *.ihx to *.hex easily.
 

The ez4.1 is suitable for programming the hex file into a 20-pin microcontrollers, 89C2051/4051. Since the hex file produced by sdcc is not sorted from low address to high address. The old version, EZ31 has bug for such hex file. So I recommened to use EZ4.1 for program loading.
 

Easy-Downloader V1.1 with SDCC

 

  • schematic:  
  • Layout in pdf:    
  • c compiler for 8051:   
  • firmware:  
  • HEX file:    
  • EZDL4:  
  • orcad files (schematic, layout):    
  • gerber file:    


資料下載.rar
 

Errata
 

  • 18 March 2004: found hardware schematic error at MAX232. The error is that pin 2 on the D-SUB 9 connector must be connected to pin 13 on the MAX232, not pin 8. The error had reported by Henrik Olesen, student at the University of Southern Denmark.

    Below picture shows how to modify the pcb!
    Easy-Downloader V1.1 with SDCC

Easy-Downloader V1.1 with SDCC


亚洲一区二区欧美_亚洲丝袜一区_99re亚洲国产精品_日韩亚洲一区二区
亚洲欧美制服另类日韩| 亚洲一区在线免费观看| 国产日韩精品一区二区三区在线| 欧美成人网在线| 久久激情五月丁香伊人| 亚洲免费在线观看视频| 日韩视频免费观看高清完整版| 久久国产手机看片| 亚洲欧美激情精品一区二区| 一本色道久久88综合日韩精品| 亚洲国产一区二区三区青草影视| 红桃视频亚洲| 黄色成人91| 精品成人a区在线观看| 国产亚洲高清视频| 国产欧美日韩精品a在线观看| 国产精品久久久久毛片大屁完整版 | 国产欧美综合在线| 国产喷白浆一区二区三区| 国产美女精品| 国产一区二区福利| 精品不卡在线| 最新成人在线| 夜夜精品视频一区二区| 亚洲午夜未删减在线观看| 亚洲小视频在线| 欧美在线国产精品| 91久久久国产精品| 一区二区三区四区精品| 亚洲欧美日韩高清| 久久久夜夜夜| 欧美精品久久久久久| 欧美日韩精品福利| 国产老女人精品毛片久久| 国语自产偷拍精品视频偷| 在线观看欧美激情| 亚洲另类自拍| 亚洲综合视频在线| 亚洲国产日韩欧美| 亚洲一区二区精品在线观看| 欧美一区二区三区免费看| 久久综合色88| 欧美日韩视频在线| 国产三级欧美三级日产三级99| 悠悠资源网久久精品| 亚洲精品中文字幕在线观看| 亚洲免费在线观看视频| 亚洲第一精品在线| 一区二区三区久久| 欧美在线视频在线播放完整版免费观看 | 一本一本久久a久久精品综合麻豆 一本一本久久a久久精品牛牛影视 | 一区免费观看| 亚洲免费高清视频| 午夜精品短视频| 亚洲精品在线二区| 欧美一区二区在线看| 欧美成人亚洲成人| 国产精品日韩精品| 1024亚洲| 亚洲一区二区视频| 亚洲日本aⅴ片在线观看香蕉| 亚洲一区亚洲| 免费一区视频| 国产精品日韩欧美一区二区三区| 精品99一区二区| 一区二区免费在线视频| 久久精品国产免费看久久精品| 亚洲视频在线观看三级| 久久蜜桃资源一区二区老牛| 欧美视频在线看| 黄色日韩网站视频| 中日韩美女免费视频网站在线观看| 欧美中文字幕视频| 亚洲一区二区在线视频| 免费av成人在线| 国产精品综合色区在线观看| 亚洲区第一页| 欧美专区中文字幕| 亚洲一区二区免费看| 免费不卡在线视频| 国产女人18毛片水18精品| 亚洲精品免费网站| 亚洲国产经典视频| 欧美一区=区| 欧美日韩中字| 91久久午夜| 亚洲激情在线观看| 久久国产综合精品| 国产精品国产三级国产aⅴ浪潮| 亚洲国产精品www| 欧美一级久久久| 亚洲欧美乱综合| 欧美三级午夜理伦三级中文幕| 亚洲福利视频二区| 久久av资源网| 欧美亚洲视频| 欧美日韩综合视频| 亚洲欧洲精品一区二区三区波多野1战4 | 中文日韩在线| 一区二区三区久久网| 欧美激情中文不卡| 亚洲国产精品激情在线观看| 久久精品久久综合| 久久久91精品国产一区二区三区| 国产精品美女久久久免费| av成人激情| 在线亚洲一区二区| 欧美激情精品久久久久久免费印度 | 日韩视频一区二区在线观看 | 亚洲国产岛国毛片在线| 亚洲欧美日韩另类精品一区二区三区| 一区二区三区成人| 欧美久久久久中文字幕| 亚洲国产婷婷| 日韩视频中文字幕| 欧美精品一区二区三区久久久竹菊| 在线精品国产成人综合| 欧美在线在线| 国产精品综合不卡av| 99www免费人成精品| 欧美一区二区三区四区高清| 国产精品久久二区| 亚洲欧美国产精品va在线观看| 午夜精品福利一区二区蜜股av| 国产精品你懂得| 午夜欧美精品久久久久久久| 欧美一区二区三区四区视频| 国产日韩欧美在线播放不卡| 午夜亚洲性色福利视频| 久久精品视频在线看| 韩国成人福利片在线播放| 久久精品视频在线看| 欧美不卡视频一区发布| 亚洲国产精品尤物yw在线观看| 亚洲日本激情| 欧美日韩和欧美的一区二区| 一区二区三区久久| 久久er精品视频| 国外视频精品毛片| 亚洲精品国产精品国自产观看| 欧美激情精品久久久久| av成人动漫| 久久激情中文| 亚洲二区在线视频| 中日韩高清电影网| 国产精品网站一区| 久久av一区| 欧美精品一区二区三| 亚洲无线一线二线三线区别av| 欧美一区二区三区视频在线| 一区二区在线视频| 一区二区三区日韩精品视频| 国产精品欧美久久久久无广告| 欧美一区成人| 欧美精品在线免费播放| 中文久久乱码一区二区| 久久久久一本一区二区青青蜜月| 亚洲国产精品va| 亚洲欧美国产高清va在线播| 好看的亚洲午夜视频在线| 亚洲三级国产| 国产精品入口福利| 亚洲激情在线播放| 国产精品久久久久婷婷| 久久成人综合视频| 欧美精品色网| 黄色日韩网站| 欧美在线播放| 欧美电影免费观看| 亚洲小说欧美另类社区| 久热精品视频在线观看| 99国产精品私拍| 激情视频一区| 国产日韩在线播放| 日韩视频二区| 国产日韩欧美夫妻视频在线观看| 最新中文字幕一区二区三区| 国产精品扒开腿做爽爽爽软件| 亚洲二区精品| 国产精品久久网站| 亚洲精品你懂的| 国产伦精品一区二区三区免费 | 国产精品xxxxx| 亚洲国产高清一区二区三区| 国产精品福利在线| 亚洲精品日韩一| 国产一区999| 亚洲一区二区三区免费观看| 在线观看国产精品网站| 午夜欧美不卡精品aaaaa| 亚洲国产精品黑人久久久| 欧美在线高清| 亚洲少妇诱惑| 欧美激情影音先锋| 久久精品国产91精品亚洲| 国产精品每日更新| 99在线观看免费视频精品观看| 国内精品久久久久久久影视蜜臀 | 日韩一区二区精品葵司在线| 美女国内精品自产拍在线播放|