⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defhc11.h

📁 USB9602 source code for C 8051
💻 H
字号:
/**********************************************************************/
/* HC11  (BUFFALO BOARD) System Dependent Values                      */
/**********************************************************************/
#include "68HC11.h"                         /*include the hc11 defines*/
#define near                                /*has no meaning here     */
#define far                                 /*has no meaning here     */

#define VID  'M'                            /*vendor ID (Motorola)    */
#define SPI                                 /*SPI is present          */
#define EEPROM                              /*EEPROM is present       */
#define INTR_TYPE INT_L_P                   /*act low pushpull ints   */

#define HALFSEC  62500                      /*timer ticks per half sec*/

/* The system clock is the 48 MHz USB clock, divided by this value:   */
#define CLKDIV   5                          /*USB clock divisor       */

/**********************************************************************/
/* These are system dependent macros and defines                      */
/**********************************************************************/
#define IO_9602 IO_USER0                    /*9602 uses IO_USER0      */

/* Initialize the stack and any other critical registers that must be */
/* setup prior to function calls and memory accesses ******************/
/* Note that for the ICC11 compiler, this is done via the _HC11Setup  */
/* procedure.                                                         */
#define INITREGS                            /*done in _HC11Setup      */

/* Send data out the SPI port *****************************************/
#define SPIOUT(dta) {                                                  \
            SPDR = dta;                     /*put in shft reg        */\
            while (!TSTBIT(SPSR,SPIF));}    /*wait until done        */

/* Turn off all SPI chip selects **************************************/
#define SPICSOFF USBCSOFF

/* send address and command out via the SPI port **********************/
#define SPIADRCMD(adr,cmd) SPIOUT((adr & 0x3F) | cmd)

/* Assert/De-assert the 9602 CS* signal *******************************/
#define USBCSON {                                                      \
            SPICSOFF;                        /*de-assert chip sels   */\
            CLRBIT(PORTD,BIT5);}             /*re-assert USB CS*      */
#define USBCSOFF SETBIT(PORTD,BIT5)

/* this macro toggles the 'heartbeat' LED *****************************/
#define HEARTBEAT

/* this macro turns on the USB activity LED ***************************/
#define USB_LED_ON  CLRBIT(PORTA,BIT5)

/* this macro turns on the USB activity LED ***************************/
#define USB_LED_OFF SETBIT(PORTA,BIT5)

/* these macros do interrupt related things ***************************/
#define INTSON  asm("cli")                  /*turn on/off all ints    */
#define INTSOFF asm("sei")
#define TXINTON  SETBIT(SCCR2,TIE)          /*turn on/off ser. tx int */
#define TXINTOFF CLRBIT(SCCR2,TIE)
#define SETVECT(vect,addr)                                             \
         {*(unsigned char *)vect=0x7E;      /*7E is "jmp"            */\
          *(void (**)())(vect+1)=addr;}     /*and this is the vector */

/* Send data out the RS-232 port **************************************/
#define PUT_TX(dta) SCDR=dta                /*transmit top of queue   */

/* Get data from the RS-232 port **************************************/
#define GET_RX(dta) dta=SCDR                /*read rx data reg        */

/* this macro returns a non-zero val if RS-232 tx is empty ************/
#define TX_EMPTY (SCSR & TDRE)              /*isolate status bit      */

/* these macros and defs take care of the bit operations **************/
#include "bitops.h"                         /*use ANSI bit operations */

⌨️ 快捷键说明

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