标题: PICMATE2002配的一个简单的演示程序 [打印本页] 作者: winnie 时间: 2009-5-18 13:46 标题: PICMATE2002配的一个简单的演示程序 /*----------------------------------------------------------------------
This program is the demonstrate for PIC16C77 with picc16
and ELSE conditional assembly block providing an alternative
path of assembly code for the Microchip type.
When the user uses which Microchip Microcontrol,he will
define set of this Microchip type in the P16XX.EQU file. And he
assemble source code of this type by the Microchip MPASM assem-
bler. Exemple the chip type is PIC16C74, P74 must define as 1
and the other types define as 0 in the P16XX.EQU file.It is the
following:
-----------------------------------------------------------------------
*/
#include <pic.h>
#include "delay.h"
#define PORTBIT(adr, bit) ((unsigned)(&adr)*8+(bit))
static bit btnRtcc @ PORTBIT(PORTA,4);
void
DelayMs(unsigned char cnt)
{
#if XTAL_FREQ <= 2MHZ
do {
DelayUs(996);
} while(--cnt);
#endif
#if XTAL_FREQ > 2MHZ
unsigned char i;
do {
i = 4;
do {
DelayUs(200);
} while(--i);
} while(--cnt);
#endif
}