tag 标签: ASC

相关博文
  • 热度 1
    2019-8-24 15:46
    2369 次阅读|
    2 个评论
    UFUN开发板实验笔记(2)
    每一件MCU设备、工具起步的第一件是就是要发出声“Hello World”,UFUN开发板也不例外。在开发板例程中已经带了Hello World程序,这个例程的名字是“基础例程4 - USB串口与PC通讯”,烧录后在串口模式下9600波特率连接,PC向UFUN发送0x10,UFUN会不断向PC发送符号拼接的“Hello World”,直到PC发送0x11才停止。 这是智能化设备“苏醒”后的常规动作,向World宣告一下“我醒了”。上期我们给UFUN添加了128x64点阵的OLED屏,并且点亮宣告“I am UFUN”,这就相当于给UFUN开发板加了一张嘴,UFUN有了表达的愿望。那么,通过小小的OLED屏幕UFUN能表达哪些内容呢?开发之前我们得了解一下,最好能让UFUN告诉我们。在上期的工程目录下我们可以找到“codetab.h”文件,这是一个点阵字库文件,里面可以看到四个点阵码表:16x16点阵汉字(用到的几个汉字)、6x8点阵字符(92个ASC字符)、8x6点阵字符(92个ASC字符)、图片点阵。我们取出6x8点阵字符码表看一下: /************************************6*8的点阵************************************/ const unsigned char F6x8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,// sp 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00,// ! 0x00, 0x00, 0x07, 0x00, 0x07, 0x00,// " 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14,// # 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12,// $ 0x00, 0x62, 0x64, 0x08, 0x13, 0x23,// % 0x00, 0x36, 0x49, 0x55, 0x22, 0x50,// & 0x00, 0x00, 0x05, 0x03, 0x00, 0x00,// ' 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00,// ( 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00,// ) 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14,// * 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,// + 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00,// , 0x00, 0x08, 0x08, 0x08, 0x08, 0x08,// - 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,// . 0x00, 0x20, 0x10, 0x08, 0x04, 0x02,// / 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,// 1 0x00, 0x42, 0x61, 0x51, 0x49, 0x46,// 2 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31,// 3 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,// 4 0x00, 0x27, 0x45, 0x45, 0x45, 0x39,// 5 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6 0x00, 0x01, 0x71, 0x09, 0x05, 0x03,// 7 0x00, 0x36, 0x49, 0x49, 0x49, 0x36,// 8 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,// 9 0x00, 0x00, 0x36, 0x36, 0x00, 0x00,// : 0x00, 0x00, 0x56, 0x36, 0x00, 0x00,// ; 0x00, 0x08, 0x14, 0x22, 0x41, 0x00,// < 0x00, 0x14, 0x14, 0x14, 0x14, 0x14,// = 0x00, 0x02, 0x01, 0x51, 0x09, 0x06,// ? 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E,// @ 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C,// A 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,// B 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,// C 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C,// D 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,// E 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,// F 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,// G 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,// H 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,// I 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01,// J 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,// K 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,// L 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F,// M 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F,// N 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,// O 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,// P 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46,// R 0x00, 0x46, 0x49, 0x49, 0x49, 0x31,// S 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,// T 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,// U 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,// V 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F,// W 0x00, 0x63, 0x14, 0x08, 0x14, 0x63,// X 0x00, 0x07, 0x08, 0x70, 0x08, 0x07,// Y 0x00, 0x61, 0x51, 0x49, 0x45, 0x43,// Z 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,// 0x00, 0x04, 0x02, 0x01, 0x02, 0x04,// ^ 0x00, 0x40, 0x40, 0x40, 0x40, 0x40,// _ 0x00, 0x00, 0x01, 0x02, 0x04, 0x00,// ' 0x00, 0x20, 0x54, 0x54, 0x54, 0x78,// a 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38,// b 0x00, 0x38, 0x44, 0x44, 0x44, 0x20,// c 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F,// d 0x00, 0x38, 0x54, 0x54, 0x54, 0x18,// e 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02,// f 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,// g 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78,// h 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00,// i 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,// j 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,// k 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00,// l 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,// m 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78,// n 0x00, 0x38, 0x44, 0x44, 0x44, 0x38,// o 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18,// p 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC,// q 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08,// r 0x00, 0x48, 0x54, 0x54, 0x54, 0x20,// s 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20,// t 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C,// u 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,// v 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C,// w 0x00, 0x44, 0x28, 0x10, 0x28, 0x44,// x 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C,// y 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44,// z 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,// horiz lines }; 从码表中我们可以大致看到点阵屏能显示的一些ASC字符内容,有了这个码表,就等于让UFUN有了表达内容的媒介——语言元素。接下来,我们要做的是让UFUN自己告诉我们它现在能显示出哪些字符。编写新程序开始,把原先的工程目录完全复制,修改目录名、工程名,该改的改,该删的删。main.c文件修改成如下内容: int main(void) { unsigned char j,n,m; unsigned char strm ; DelayInit(); I2C_Configuration(); OLED_Init(); OLED_Fill(0x00);//清屏 while(1) { OLED_ShowStr(0,0,"I can show (6x8):",1);// 标题测试6*8字符 for(j=0;j<7;j++) { for(n=0;n<14;n++) { m=j*14+n+32; strm =m; strm =0; OLED_ShowStr(n*8+8,j+1,strm,1); } } DelayS(3); } } 重要的是要将码表中的内容按顺序排列在128x64点阵屏内,第一行显示标题,64/8还剩7行,每行显示14个字符,总共可以显示98个字符,还多出了6个位置。每行14个字符,共需14x6=84点,每字后面空2个点,14x8=112点。128-112=16点,左右各空8点正好,算上末尾字符无需空的两点,实际左右各空9个点也是合适。看着短短的几行,花费了一上午的时间,原因在于如何把数值变为字符串成为显示函数的参数颇费周折,不多说,看看最后的显示效果。 附件: LED能显示哪些ASC符号源程序 https://mbb.eet-china.com/download/20407.html
相关资源
  • 所需E币: 4
    时间: 2019-12-25 15:01
    大小: 384.51KB
    上传者: 2iot
    Datatransmissionandstoragecostmoney.Themoreinformationbeingdealtwith,themoreitcosts.Inspiteofthis,mostdigitaldataarenotstoredinthemostcompactform.Rather,theyarestoredinwhateverwaymakesthemeasiesttouse,suchas:ASCIItextfromwordprocessors,binarycodethatcanbeexecutedonacomputer,individualsamplesfromadataacquisitionsystem,etc.Typically,theseeasy-to-useencodingmethodsrequiredatafilesabouttwiceaslargeasactuallyneededtorepresenttheinformation.Datacompressionisthegeneraltermforthevariousalgorithmsandprogramsdevelopedtoaddressthisproblem.Acompressionprogramisusedtoconvertdatafromaneasy-to-useformattooneoptimizedforcompactness.Likewise,anuncompressionprogramreturnstheinformationtoitsoriginalform.Weexaminefivetechniquesfordatacompressioninthischapter.Thefirstthreearesimpleencodingtechniques,called:runlength,Huffman,anddeltaencoding.Thelasttwoareelaborateproceduresthathaveestablishedthemselvesasindustrystandards:LZWandJPEG.CHAPTERDataCompression27Datatransmissionandstoragecostmoney.Themoreinformationbeingdealtwith,themoreitcosts.Inspiteofthis,mostdigitaldataarenotstoredinthemostcompactform.Rather,theyarestoredinwhateverwaymakesthemeasiesttouse,suchas:ASCIItextfromwordprocessors,binarycodethatcanbeexecutedonacomputer,individualsamplesfromadataacquisitionsystem,etc.Typically,theseeasy-to-useencodingmethodsrequiredatafilesabouttwiceaslargeasactuallyneededtorepresenttheinformation.Datacompressionisthegeneraltermforthevariousalgorithmsandprogramsdevelopedtoaddressthisproblem.Acompressionprogramisusedtoconvertdatafromaneasy-to-useformattooneoptimized……
  • 所需E币: 3
    时间: 2019-12-24 20:12
    大小: 325.74KB
    上传者: 238112554_qq
    infineonc16x系列通过单片机同步串行接口仿真异步串行接口ApplicationNote,V1.0,Feb.2004AP16051SABC161K/V/OEmulatinganasynchronousserialinterface(ASC)viatheon-chipsynchronousserialinterface(SSC).MicrocontrollersNeverstopthinking.SABC161K/V/ORevisionHistory:2004-02V1.0PreviousVersion:-PageSubjects(majorchangessincelastrevision)AllUpdatedLayouttoInfineonCorporateDesign,updatedreleaseto1.0,Contentunchanged!ControllerAreaNetwork(CAN):LicenseofRobertBoschGmbHWeListentoYourCommentsAnyinformationwithinthisdocumentthatyoufeeliswrong,u……
  • 所需E币: 3
    时间: 2019-12-24 19:54
    大小: 325.74KB
    上传者: quw431979_163.com
    infineonc16x系列同步串行接口仿真异步串行接口ApplicationNote,V1.0,Feb.2004AP16051SABC161K/V/OEmulatinganasynchronousserialinterface(ASC)viatheon-chipsynchronousserialinterface(SSC).MicrocontrollersNeverstopthinking.SABC161K/V/ORevisionHistory:2004-02V1.0PreviousVersion:-PageSubjects(majorchangessincelastrevision)AllUpdatedLayouttoInfineonCorporateDesign,updatedreleaseto1.0,Contentunchanged!ControllerAreaNetwork(CAN):LicenseofRobertBoschGmbHWeListentoYourCommentsAnyinformationwithinthisdocumentthatyoufeeliswrong,u……