📄 main.inc
字号:
;----------------------------------------------------------------------
; PICDEM(R) System Monitoring Demo Board
;----------------------------------------------------------------------
#include <p16f690.inc> ; processor specific variable definitions
;----------------------------------------------------------------------
; I/O Ports Configuration
;----------------------------------------------------------------------
;--------------------
; PORTA (Section 4.1)
;--------------------
; PORTA is an 6-bit wide, bi-directional port. The corresponding data
; direction register is TRISA. Setting a TRISA bit (= 1) will make
; the corresponding PORTA pin and input. Clearing a TRISA bit (= 0)
; will make the corresponding PORTA pin an output. The exception is
; RA3, which is input only and its TRIS bit will always read as a '1'.
;
; Function of PORTA pins depend on:
; Configuration Bits (CONFIG) (Section 14.1)
; Weak Pull-up PORTA Register (WPUA) (Section 4.2.1)
; Interrupt-on-change PORTA Register (IOCA) (Section 4.2.2)
; Ultra Low-Power Wake-up (Section 4.2.3)
; Option Register (OPTION_REG) (Register 2-2)
; TIMER1 Control Register (T1CON) (Register 6-1)
; Comparator Module (Section 8)
; Comparator Reference (Section 8)
; A/D Control Register (ADCON0) (Section 9)
#define SSCDAT PORTA, 0 ; (Digital Input/Output)
#define SSCCLK PORTA, 1 ; (Digital Input/Output)
#define RA2 PORTA, 2 ; (Digital Input/Output)
#define RA3 PORTA, 3 ; (Digital Input Only)
#define T1G PORTA, 4 ; (Digital Input) Timer1 Gate NOT input
#define RA5 PORTA, 5 ; (Digital Input/Output)
; Define for TRISA Register
; PORTA Pins = xx543210
#define PORT_A_TRIS b'11111111'
;--------------------
; PORTB (Section 4.3)
;--------------------
; PORTB is a general purpose I/O port consisting of 4 bi-directional
; pins.
;
; Function of PORTB pins depend on:
; Weak Pull-up PORTB Register (WPUB) (Section 4.4.1)
; Interrupt-on-change PORTB Register (IOCB) (Section 4.4.2)
; A/D Control Register (ADCON0) (Section 9)
; EUSART (Section 12)
; SSP Module (Section 13)
#define RB4 PORTB, 4 ;
#define RB5 PORTB, 5 ;
#define RB6 PORTB, 6 ;
#define RB7 PORTB, 7 ;
; Define for TRISB Register
; PORTB Pins = 7654xxxx
#define PORT_B_TRIS b'11111111'
;--------------------
; PORTC (Section 4.5)
;--------------------
; PORTC is a general purpose I/O port consisting of 8 bi-directional
; pins. The pins can be configured for either digital I/O or analog
; input to A/D converter. For specific information about individual
; functions such as the Enhanced CCP or the A/D, refer to the
; appropriate section in the data sheet.
;
; Function of PORTC pins depend on:
; Comparator Module (Section 8)
; Analog-to-Digital Converter (A/D) Module (Section 9)
; ECCP Module (Section 11)
; SSP Module (Section 13)
#define RC0 PORTC, 0 ;
#define Vsen PORTC, 1 ; (Analog Input) Voltage Sense
#define Vint PORTC, 2 ; (Digital Output) Voltage Integration
#define SO PORTC, 3 ; (Digital Output)
#define Q_NOT_OUT PORTC, 4 ; (Digitial Output) SR Latch Q_NOT output
#define RC5 PORTC, 5 ; (Digital Output) Trigger
#define RC6 PORTC, 6 ;
#define RC7 PORTC, 7 ;
; Define for TRISC Register
; PORTC Pins = 76543210
#define PORT_C_TRIS b'11000011'
;----------------------------------------------------------------------
; Global Defines
;----------------------------------------------------------------------
#define CLOCKSPEED .8000000 ; 8 MHz Osc
#define VERSION 0x02 ; Firmware version number
#define CMD_UNSUCCESSFUL 0xFF
#define CMD_Version_ACK 0x10 ; Version command was successful
#define CMD_01_ACK 0x11 ;
#define CMD_02_ACK 0x12 ;
#define CMD_03_ACK 0x13 ;
#define CMD_04_ACK 0x14 ;
#define CMD_05_ACK 0x15 ;
#define CMD_06_ACK 0x16 ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -