[信息与通信]网工业络_6章_LonWorks.ppt

[信息与通信]网工业络_6章_LonWorks

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   * * * * * 工业计算机网络与通信 * LonWorks节点电路图 工业计算机网络与通信 * LonWorks节点软件流程 LonWorks / EIA-232网关的单片机程序 LonWorks / 模拟量输出网关的单片机程序 Neuron 3150程序 工业计算机网络与通信 * PC机侧 阀侧 工业计算机网络与通信 * Neuron 3150流程图 工业计算机网络与通信 * LonWorks节点源程序:单片机 void Init_Neuron(void) { DDRC = 0x01; //PC0为输出 PORTC = 0x01; //PC0输出高电平使Neuron 3150复位 RstNeuFlag = TRUE; } void timer0_init(void) //for T/C0 { TCCR0 = 0x00; //stop TCNT0 = 0x00; //set count OCR0 = 0xFA; //set compare TCCR0 = 0x0C; // CTC, /64 prescaler ,--1ms } #pragma interrupt_handler ta0:16 void ta0(void) // compare occured TCNT1=OCR1A { if(RstNeuFlag == TRUE) RstNeuDelay++; } 工业计算机网络与通信 * #define TRUE 1 #define FALSE 0 #define NEURON_RST 0x01 //PC0 #define ENABLE_NEURON {DDRC |= NEURON_RST; PORTC = ~NEURON_RST;} unsigned char RstNeuFlag, RstNeuDelay=0; void main(void) { Init_Neuron(); timer0_init(); TIMSK = 0x02; //只允许Timer0溢出中断 ETIMSK = 0x00; SREG=0X80; //使能全局中断 if(RstNeuDelay = 200) { RstNeuFlag = FALSE; RstNeuDelay = 0; ENABLE_NEURON; } } 工业计算机网络与通信 * LonWorks节点源程序:Neuron 3150 #include control.h #include status.h //structure type defined   #include addrdefs.h #include msg_addr.h #include access.h // #include echelon.h //Neuron-C Extensions #include float.h /*TYPE DEFINIENS*/ typedef unsigned char uchar; typedef signed char schar; typedef unsigned int uint; typedef signed int sint; 工业计算机网络与通信 * #define NV_UP_SIZE 3 //设置网络变量nv_up_a数据长度 #define NV_DOWN_SIZE 3 //设置网络变量nv_down_b数据长度 typedef struct NN_UPWARD_REPORT { uint length; uint data[NV_UP_SIZE]; } nv_up_def; typedef struct NN_DOWNWARD_REPORT { uint length; uint data[NV_DOWN_SIZE]; } nv_down_def; 工业计算机网络与通信 * /*VARIABLE DEFI

文档评论(0)

1亿VIP精品文档

相关文档