📄 node_b.c
字号:
/** ###################################################################
** Filename : Node_B.C
** Project : Node_B
** Processor : MC9S12C64CFA16
** Version : Driver 01.11
** Compiler : Metrowerks HC12 C Compiler
** Date/Time : 2006-11-11, 15:02
** Abstract :
** Main module.
** Here is to be placed user's code.
** Settings :
** Contents :
** No public methods
**
** (c) Copyright UNIS, spol. s r.o. 1997-2005
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
/* MODULE Node_B */
/* Including used modules for compiling procedure */
#include "Cpu.h"
#include "Events.h"
#include "CAN1.h"
#include "Byte1.h"
/* Include shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
byte led_number;
extern byte can_messageData[8];
void main(void)
{
dword i;
byte led;
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
led = 0xFF;
led_number = 0;
for(;;)
{
switch(can_messageData[1])
{
case '1':
//Flash one by one
Byte1_PutVal(led);
led = 1 << led_number;
led_number++;
if(led_number == 8)
{
led_number = 0;
}
for(i=0;i<0xFFFF;i++);
break;
case '2':
//Odd is On, Even is Off
Byte1_PutVal(0x55);
break;
case '3':
//Shift
Byte1_PutVal(led);
led >>= 1;
if(led == 0)
{
led = 0xFF;
}
for(i=0;i<0xFFFF;i++);
break;
case '4':
//All are On
Byte1_PutVal(0xFF);
break;
case '5':
//All are Off
Byte1_PutVal(0x00);
break;
default:
break;
}
}
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END Node_B */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.96 [03.76]
** for the Freescale HCS12 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -