circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 99, October 1998
Networking with DeviceNet—Part 2: A Weather Station Application


by Jim Brady

Start Can Chips Chip Setup Real Time Message Flow Connections Timers Analog Input Point Identity Object Fragmented Messages Getting Physical Applying DeviceNET Software,Sources

TIMERS

For each connection, you need a time-out timer. You also need a timer for sending fragments. The BIOS clock is handy, but who wants to deal with 18.2 Hz?

With the Micro/sys board, the 25-MHz system clock is divided by 21 to drive timer 0 in the ’386EX. Timer 0 further divides by 65,536, producing 18.2 Hz. Loading 0xE884 into the timer 0 count register resulted in BIOS clock interrupts at a more friendly rate of 20.0 Hz.

The connection time-out time depends on the expected packet rate, which is set by the master. When a DeviceNet message comes in, I reload the timer for that connection, and my timer interrupt handler then decrements it at a 20.0-Hz rate. If it reaches zero before another message comes in, the connection times out.