target.c

来自「8051试验程序 基础教材」· C语言 代码 · 共 44 行

C
44
字号


#include "target.h"


void ms_delay( int ms )
{
  /* delay for approx. 'ms' milli seconds */
  while( ms != 0 )
  {
    for( int i=0; i<150; ++i )
    {
      asm( "NOP" );
    }

    ms -= 1;
  }
}

void target_init(void)
{
  /* target init such as PLL trim etc. */
}


void port_init(void)
{
  /* setup ports to be used communicating with the LCD */

  /* communication pins needs to be set as output */

  /* D4 - D7, e, _RS, RW and LIGHT is for us located  at P00 - P07 */
  /* we use */
  P0M1 = 0x00;
  P0M2 = 0xFF;

  /* reset port value to 0x00 */
  P0   = 0x00;
}




⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?