PIC單片機(jī)廣告燈程序
//** Date: Wednesday, November 21, 2012 21:51:18
#define MX_PIC
//Defines for microcontroller
#define P16F690
#define MX_EE
#define MX_EE_SIZE 256
#define MX_SPI
#define MX_SPI_BCB
#define MX_SPI_SDI 4
#define MX_SPI_SDO 7
#define MX_SPI_SCK 6
#define MX_UART
#define MX_UART_B
#define MX_UART_TX 7
#define MX_UART_RX 5
#define MX_I2C
#define MX_MI2C
#define MX_I2C_B
#define MX_I2C_SDA 4
#define MX_I2C_SCL 6
#define MX_PWM
#define MX_PWM_CNT 1
#define MX_PWM_TRIS1 trisc
#define MX_PWM_1 5
#define P16F690
#define MX_EE
#define MX_EE_SIZE 256
#define MX_SPI
#define MX_SPI_BCB
#define MX_SPI_SDI 4
#define MX_SPI_SDO 7
#define MX_SPI_SCK 6
#define MX_UART
#define MX_UART_B
#define MX_UART_TX 7
#define MX_UART_RX 5
#define MX_I2C
#define MX_MI2C
#define MX_I2C_B
#define MX_I2C_SDA 4
#define MX_I2C_SCL 6
#define MX_PWM
#define MX_PWM_CNT 1
#define MX_PWM_TRIS1 trisc
#define MX_PWM_1 5
//Functions
#define MX_CLK_SPEED 19660800
#ifdef _BOOSTC
#include
#endif
#ifdef HI_TECH_C
#include
#endif
#define MX_CLK_SPEED 19660800
#ifdef _BOOSTC
#include
#endif
#ifdef HI_TECH_C
#include
#endif
//Configuration data
//Internal functions
#include "F:Program FilesMatrix MultimediaFlowcode V4FCDinternals.h"
#include "F:Program FilesMatrix MultimediaFlowcode V4FCDinternals.h"
//Macro function declarations
void FCM_L();
void FCM_R();
void FCM_S();
void FCM_L();
void FCM_R();
void FCM_S();
//Variable declarations
char FCV_AR;
char FCV_AS;
char FCV_AL;
char FCV_COUNT;
//Macro implementations
void FCM_L()
{
FCV_COUNT = 0;
while (FCV_COUNT<2)
{
FCV_AL = 0x01;
while (FCV_AL>0)
{
trisc = 0x00;
portc = FCV_AL;
delay_ms(100);
FCV_AL = FCV_AL<<1;
{
FCV_COUNT = 0;
while (FCV_COUNT<2)
{
FCV_AL = 0x01;
while (FCV_AL>0)
{
trisc = 0x00;
portc = FCV_AL;
delay_ms(100);
FCV_AL = FCV_AL<<1;
}
FCV_COUNT = FCV_COUNT+1;
FCV_COUNT = FCV_COUNT+1;
}
}
}
void FCM_R()
{
FCV_COUNT = 0;
while (FCV_COUNT<2)
{
FCV_AR = 0x80;
while (FCV_AR>0)
{
trisc = 0x00;
portc = FCV_AR;
delay_ms(100);
FCV_AR = FCV_AR>>1;
{
FCV_COUNT = 0;
while (FCV_COUNT<2)
{
FCV_AR = 0x80;
while (FCV_AR>0)
{
trisc = 0x00;
portc = FCV_AR;
delay_ms(100);
FCV_AR = FCV_AR>>1;
}
FCV_COUNT = FCV_COUNT+1;
FCV_COUNT = FCV_COUNT+1;
}
}
}
void FCM_S()
{
FCV_COUNT = 0;
while (FCV_COUNT<2)
{
FCV_AS = 0xFF;
trisc = 0x00;
portc = FCV_AS;
delay_ms(100);
FCV_AS = 0x00;
trisc = 0x00;
portc = FCV_AS;
delay_ms(100);
FCV_COUNT = FCV_COUNT+1;
{
FCV_COUNT = 0;
while (FCV_COUNT<2)
{
FCV_AS = 0xFF;
trisc = 0x00;
portc = FCV_AS;
delay_ms(100);
FCV_AS = 0x00;
trisc = 0x00;
portc = FCV_AS;
delay_ms(100);
FCV_COUNT = FCV_COUNT+1;
}
}
}
void main()
{
//Initialisation
ansel = 0;
anselh = 0;
{
//Initialisation
ansel = 0;
anselh = 0;
//Interrupt initialisation code
option_reg = 0xC0;
//Loop
//Loop: While 1
while (1)
{
FCM_L();
FCM_R();
FCM_S();
}
mainendloop: goto mainendloop;
}
void MX_INTERRUPT_MACRO(void)
{
}
{
}
評(píng)論