电设报告 - 图文(6)

2019-06-02 14:00

DOGS102x6_DRAW_NORMAL);

Dogs102x6_charDraw(7,0,ptr0[0],DOGS102x6_DRAW_NORMAL);//将一个字符写入确定行列的LCD液晶显示屏上

Dogs102x6_charDraw(7,6,ptr0[1],DOGS102x6_DRAW_NORMAL);//将一个字符写入确定行列的LCD液晶显示屏上

Dogs102x6_charDraw(7,12,ptr0[2],DOGS102x6_DRAW_NORMAL);//将一个字符写入确定行列的LCD液晶显示屏上

Dogs102x6_charDraw(7,18,ptr0[3],DOGS102x6_DRAW_NORMAL);//将一个字符写入确定行列的LCD液晶显示屏上

Dogs102x6_charDraw(7,24,ptr0[4],DOGS102x6_DRAW_NORMAL);//将一个字符写入确定行列的LCD液晶显示屏上 break; //

case 5: break; // default: break; } }

/**sub functions**/

externcharspi_readByte( uint8_taddr, uint8_t * data) {

rxlen = 1;

rxbuf = data;

txaddr = addr | 0x80;

P2OUT &= ~BIT0;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = txaddr;

while (!(UCB0IFG&UCTXIFG));

UCB0TXBUF = 0;

while (UCB0STAT & UCBUSY); * rxbuf = UCB0RXBUF;

while (UCB0STAT & UCBUSY); P2OUT |= BIT0;

return 0; }

externcharspi_readWord(uint8_taddr, unsignedint * data) {

rxlen = 2;

rxbuf = &wordbuf[0]; txaddr = addr | 0x80;

P2OUT &= ~BIT0;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = txaddr;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = 0;

while (UCB0STAT & UCBUSY); * rxbuf = UCB0RXBUF; rxbuf++;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = 0;

while (UCB0STAT & UCBUSY); * rxbuf = UCB0RXBUF;

while (UCB0STAT & UCBUSY); P2OUT |= BIT0;

return 0;

}

externcharspi_readBytes( uint8_taddr, uint8_t * buffer, uint8_tlen) {

rxlen = len; rxbuf = buffer;

txaddr = addr | 0x80;

P2OUT &= ~BIT0;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = txaddr;

while (rxlen> 0) {

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = 0;

while (UCB0STAT & UCBUSY); * rxbuf = UCB0RXBUF; rxbuf++; rxlen--; }

while (UCB0STAT & UCBUSY); P2OUT |= BIT0;

return 0; }

externcharspi_writeByte(uint8_taddr, uint8_t data) {

wordbuf[0] = data; // copy from stack to memory txlen = 1;

txbuf = &wordbuf[0]; txaddr = addr& ~0x80;

P2OUT &= ~BIT0;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = txaddr;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = *txbuf;

while (UCB0STAT & UCBUSY); P2OUT |= BIT0;

return 0; }

externcharspi_writeWord(uint8_taddr, unsignedint data) {

wordbuf[0] = data >> 8; // Big Endian wordbuf[1] = data & 0xFF; txlen = 2;

txbuf = &wordbuf[0]; txaddr = addr& ~0x80;

P2OUT &= ~BIT0;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = txaddr;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = *txbuf; txbuf++;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = *txbuf;

while (UCB0STAT & UCBUSY); P2OUT |= BIT0;

return 0;

}

externcharspi_writeBytes( uint8_t addr,uint8_t * buffer, uint8_tlen) {

txlen = len; txbuf = buffer;

txaddr = addr& ~0x80;

P2OUT &= ~BIT0;

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = txaddr;

while (txlen> 0) {

while (!(UCB0IFG&UCTXIFG)); UCB0TXBUF = *txbuf; txbuf++; txlen--; }

while (UCB0STAT & UCBUSY); P2OUT |= BIT0;

return 0; }

//////////////////////////////////////步进电////////////////////////////////////////////// //延时n*0.5ms //P4口延时函数

voiddelay_nms1(unsignedint n)

机程序


电设报告 - 图文(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:江苏无锡金桥双语实验学校2016小升初考试语文真题

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: