ASCII char to HEX mapping

本文详细介绍ASCII码表的内容,包括从00到7F的十六进制表示及其对应的字符。通过此表可以清晰地了解每个字符的编码方式,适用于计算机科学领域的初学者和技术人员参考。
+----+-----+----+-----+----+-----+----+-----+
| Hx | Chr | Hx | Chr | Hx | Chr | Hx | Chr |
+----+-----+----+-----+----+-----+----+-----+
| 00 | NUL | 20 | SPC | 40 | @ | 60 | ` |
| 01 | SOH | 21 | ! | 41 | A | 61 | a |
| 02 | STX | 22 | " | 42 | B | 62 | b |
| 03 | ETX | 23 | # | 43 | C | 63 | c |
| 04 | EOT | 24 | $ | 44 | D | 64 | d |
| 05 | ENQ | 25 | % | 45 | E | 65 | e |
| 06 | ACK | 26 | & | 46 | F | 66 | f |
| 07 | BEL | 27 | ' | 47 | G | 67 | g |
| 08 | BS | 28 | ( | 48 | H | 68 | h |
| 09 | TAB | 29 | ) | 49 | I | 69 | i |
| 0A | LF | 2A | * | 4A | J | 6A | j |
| 0B | VT | 2B | + | 4B | K | 6B | k |
| 0C | FF | 2C | , | 4C | L | 6C | l |
| 0D | CR | 2D | - | 4D | M | 6D | m |
| 0E | SO | 2E | . | 4E | N | 6E | n |
| 0F | SI | 2F | / | 4F | O | 6F | o |
| 10 | DLE | 30 | 0 | 50 | P | 70 | p |
| 11 | DC1 | 31 | 1 | 51 | Q | 71 | q |
| 12 | DC2 | 32 | 2 | 52 | R | 72 | r |
| 13 | DC3 | 33 | 3 | 53 | S | 73 | s |
| 14 | DC4 | 34 | 4 | 54 | T | 74 | t |
| 15 | NAK | 35 | 5 | 55 | U | 75 | u |
| 16 | SYN | 36 | 6 | 56 | V | 76 | v |
| 17 | ETB | 37 | 7 | 57 | W | 77 | w |
| 18 | CAN | 38 | 8 | 58 | X | 78 | x |
| 19 | EM | 39 | 9 | 59 | Y | 79 | y |
| 1A | SUB | 3A | : | 5A | Z | 7A | z |
| 1B | ESC | 3B | ; | 5B | [ | 7B | { |
| 1C | FS | 3C | < | 5C | \ | 7C | | |
| 1D | GS | 3D | = | 5D | ] | 7D | } |
| 1E | RS | 3E | > | 5E | ^ | 7E | ~ |
| 1F | US | 3F | ? | 5F | _ | 7F | DEL |
+----+-----+----+-----+----+-----+----+-----+



https://stackoverflow.com/questions/6182356/what-is-2c-in-a-url
http://www.asciitable.com/
/* * OLED.c * * Created on: 2024年3月29日 * Author: alpha */ #include "OLED.h" #include "oledchar.h" Uint16 OLED_GRAM[128][8]; void OLED_Init(void){ EALLOW; //all operations on registers need to be Add GpioCtrlRegs.SCLMUX.bit.SCL = GPIOMUX_GPIO; GpioCtrlRegs.SCLDIR.bit.SCL = GPIODIR_OUTPUT; //OUTPUT GpioCtrlRegs.SCLPUD.bit.SCL = GPIOPUD_PULLUP; //PULLUP GpioCtrlRegs.SDAMUX.bit.SDA = GPIOMUX_GPIO; GpioCtrlRegs.SDADIR.bit.SDA = GPIODIR_OUTPUT; GpioCtrlRegs.SDAPUD.bit.SDA = GPIOPUD_PULLUP; SCL_LOW; SDA_LOW; EDIS; OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel OLED_WR_Byte(0x00,OLED_CMD);//---set low column address OLED_WR_Byte(0x10,OLED_CMD);//---set high column address OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F) OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register OLED_WR_Byte(0xCF,OLED_CMD);// Set SEG Output Current Brightness OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64) OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F) OLED_WR_Byte(0x00,OLED_CMD);//-not offset OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration OLED_WR_Byte(0x12,OLED_CMD); OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh OLED_WR_Byte(0x30,OLED_CMD);//Set VCOM Deselect Level OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02) OLED_WR_Byte(0x02,OLED_CMD);// Page Addressing Mode OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable OLED_Clear(); OLED_WR_Byte(0xAF,OLED_CMD); /* OLED_WR_Byte(0xAE,OLED_CMD);//--display off OLED_WR_Byte(0x00,OLED_CMD);//---set low column address OLED_WR_Byte(0x10,OLED_CMD);//---set high column address OLED_WR_Byte(0x40,OLED_CMD);//--set start line address OLED_WR_Byte(0xB0,OLED_CMD);//--set page address OLED_WR_Byte(0x81,OLED_CMD); // contract control OLED_WR_Byte(0xFF,OLED_CMD);//--128 OLED_WR_Byte(0xA0,OLED_CMD);//!!!!设定x方向,0xA0选择正常方向(0xA1为反方向) OLED_WR_Byte(0xA6,OLED_CMD);//--normal / reverse OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64) OLED_WR_Byte(0x3F,OLED_CMD);//--1/32 duty OLED_WR_Byte(0xC0,OLED_CMD);//!!!!设定Y方向,0xC8正常反向,0xC0为正常方向 OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset OLED_WR_Byte(0x00,OLED_CMD);// OLED_WR_Byte(0xD5,OLED_CMD);//set osc division OLED_WR_Byte(0x80,OLED_CMD);// OLED_WR_Byte(0xD8,OLED_CMD);//set area color mode off OLED_WR_Byte(0x05,OLED_CMD);// OLED_WR_Byte(0xD9,OLED_CMD);//Set Pre-Charge Period OLED_WR_Byte(0xF1,OLED_CMD);// OLED_WR_Byte(0xDA,OLED_CMD);//set com pin configuartion OLED_WR_Byte(0x12,OLED_CMD);// OLED_WR_Byte(0xDB,OLED_CMD);//set Vcomh OLED_WR_Byte(0x30,OLED_CMD);// OLED_WR_Byte(0x8D,OLED_CMD);//set charge pump enable OLED_WR_Byte(0x14,OLED_CMD);// OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel */ } //send one byte, mode:0:command, 1:data void OLED_WR_Byte(Uint16 dat,Uint16 mode){ I2C_Start(); Send_Byte(0x78); //OLED address I2C_WaitAck(); if(mode) Send_Byte(0x40); //will write a data else Send_Byte(0x00); //will write a command I2C_WaitAck(); Send_Byte(dat); I2C_WaitAck(); I2C_Stop(); } void I2C_Start(void){ SDA_HIGH; IIC_Delay; SCL_HIGH; IIC_Delay; SDA_LOW; IIC_Delay; SCL_LOW; IIC_Delay; } void I2C_Stop(void){ SDA_LOW; IIC_Delay; SCL_HIGH; IIC_Delay; SDA_HIGH; IIC_Delay; IIC_Delay; } void Send_Byte(Uint16 dat){ Uint16 i; for(i=0;i<8;i++){ if(dat&0x80)//write High bit first SDA_HIGH; else SDA_LOW; IIC_Delay; SCL_HIGH; IIC_Delay; SCL_LOW;// one clock dat<<=1; IIC_Delay; //SDA_LOW; // IIC_Delay; } } void I2C_WaitAck(void){ SDA_HIGH; IIC_Delay; SCL_HIGH; IIC_Delay; SCL_LOW; IIC_Delay; } void OLED_Clear(void){ Uint16 i,n; for(i=0;i<8;i++){ for(n=0;n<128;n++) OLED_GRAM[n][i]=0;//clear all data } //OLED_Refresh();// } //x:0~127 y:0~7 void OLED_Clear_fix(U8 x1, U8 x2, U8 y1, U8 y2){ U8 i,n; for(i=y1;i<=y2;i++){ for(n=x1;n<=x2;n++) OLED_GRAM[n][i]=0;//clear all data } } void OLED_Refresh(void){ Uint16 i,n; for(i=0;i<8;i++){ OLED_WR_Byte(0xb0+i,OLED_CMD); //set line starting address OLED_WR_Byte(0x00,OLED_CMD); //set low column starting address OLED_WR_Byte(0x10,OLED_CMD); //set high column starting address I2C_Start(); Send_Byte(0x78); I2C_WaitAck(); Send_Byte(0x40); //will send data later I2C_WaitAck(); for(n=0;n<128;n++){ Send_Byte(OLED_GRAM[n][i]); I2C_WaitAck(); } I2C_Stop(); } } // x:0~128 y:0~8 void OLED_Refresh_fix(Uint16 x1, Uint16 x2, Uint16 y){ Uint16 n=x1; OLED_WR_Byte(0xb0+y,OLED_CMD); //set line starting address 8 line 128 column 0xb2 OLED_WR_Byte(0x00|(n&0x0f),OLED_CMD); //starting address low 4bit 0x00~0x0f 0x00 n=n>>4; OLED_WR_Byte(0x10|(n&0x0f),OLED_CMD); //starting address high 4bit 0x10~0x17 eg: 0x0a, 0x1b -> start column: 0xab I2C_Start(); Send_Byte(0x78); I2C_WaitAck(); Send_Byte(0x40); //will send data later I2C_WaitAck(); for(n=x1;n<x2;n++){ Send_Byte(OLED_GRAM[n][y]); I2C_WaitAck(); } I2C_Stop(); } //X:0~128 y:0~64 void OLED_DrawPoint(Uint16 x,Uint16 y,Uint16 t) { Uint16 i,m,n; i=y/8; m=y%8; n=1<<m; if(t){OLED_GRAM[x][i]|=n;} else { OLED_GRAM[x][i]=~OLED_GRAM[x][i]; OLED_GRAM[x][i]|=n; OLED_GRAM[x][i]=~OLED_GRAM[x][i]; } } //X:0~128 y:0~64 void OLED_ShowChar(Uint16 x,Uint16 y,char chr, Uint16 mode) { Uint16 i,m,temp,size2,chr1; Uint16 y0=y;//x0=x, //if(size1==8)size2=6; size2 = 6; chr1 = chr-' '; //calculate the offset value for(i=0; i<size2; i++){ temp = asc2_0806[chr1][i]; //call 0806 font for(m=0;m<8;m++){ if(temp&0x01) OLED_DrawPoint(x, y, mode); else OLED_DrawPoint(x, y, !mode); temp>>=1; y++; } x++; //if((size1!=8)&&((x-x0)==size1/2)) //{x=x0;y0=y0+8;} y=y0; } } //X:0~128 y:0~64 void OLED_ShowString(Uint16 x,Uint16 y,char *chr,Uint16 mode) { while((*chr>=' ')&&(*chr<='~'))// { OLED_ShowChar(x,y,*chr,mode); x += 6; chr++; } } //X:0~128 y:0~64 void OLED_ShowInt(Uint16 x, Uint16 y, Uint32 num, Uint16 mode){ Uint16 bitnum=0; Uint32 temp = num; Uint16 i=0; if(!num) bitnum++; while(temp){ bitnum++; temp=temp/10; } for(i=0;i<bitnum;i++){ OLED_ShowChar(x+6*bitnum-(6*i)-6, y, num%10 +'0', mode); num=num/10; } } //X:0~128 y:0~64 void OLED_ShowHex(Uint16 x, Uint16 y, Uint32 hex, Uint16 mode){ Uint32 temp=hex; Uint16 i=0, bitnum=0; if(!hex) bitnum++; while(temp){ bitnum++; temp=temp/16; } for(i=0;i<bitnum;i++){ if(hex%16<10) OLED_ShowChar(x+6*bitnum-(6*i)-6, y, hex%16+'0', mode); else OLED_ShowChar(x+6*bitnum-(6*i)-6, y, hex%16-10+'A', mode); hex=hex/16; } } void OLED_ShowHexfix(Uint16 x, Uint16 y, Uint32 hex, Uint16 bitnum, Uint16 mode){ Uint32 temp=hex; Uint16 i=0; for(i=0;i<bitnum;i++){ if(hex%16<10) OLED_ShowChar(x+6*bitnum-(6*i)-6, y, hex%16+'0', mode); else OLED_ShowChar(x+6*bitnum-(6*i)-6, y, hex%16-10+'A', mode); hex=hex/16; } } //X:0~128 y:0~64 void OLED_ShowPicture(Uint16 x,Uint16 y,Uint16 sizex,Uint16 sizey,U8 BMP[],Uint16 mode) { Uint16 j=0; Uint16 i,n,temp,m; Uint16 x0=x,y0=y; sizey=sizey/8+((sizey%8)?1:0); for(n=0;n<sizey;n++){ for(i=0;i<sizex;i++){ temp=BMP[j]; j++; for(m=0;m<8;m++){ if(temp&0x01) OLED_DrawPoint(x,y,mode); else OLED_DrawPoint(x,y,!mode); temp>>=1; y++; } x++; if((x-x0)==sizex){ x=x0; y0=y0+8; } y=y0; } } }
最新发布
07-26
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值