Sample Programs; Position Acquisition With Hardware Support (Bg_Mode = "0") - Siemens SMP16-SFT251 Technical Description

Counter board with two 32-bit incremental/pulse counters
Table of Contents

Advertisement

Sample Programs

7
Sample Programs
7.1
Position Acquisition with Hardware Support (BG_Mode =
"0")
Prerequisites:
Base address for ASBIC channel 0 = 400hex
The "ext. strobe channel n" bits must be activated on the parallel output port of the ASBIC.
/*****************************************************
** Initialize board:
*****************************************************/
// Enable zero-marking-pulse inputs
outportb (0x414,0x00);
// Cancel counter write protection for counting channel 0
dummy = inportb(0x411);
// Specify mode register for counting channel 0
// Position acquisition without hysteresis. Quadruple edge evaluation.
outportb(0x405,0x00);
// Cancel counter write protection for counting channel 1
dummy = inportb(0x412);
// Specify mode register for counting channel 1
//Position acquisition without hysteresis. Double edge evaluation.
outportb(0x40D,0x01);
// Setting the operating mode:
// Counting channel 0: Activate hardware support, with one-time counter
// Counting channel 1: Activate hardware support, without one-time counter
// Interrupts are disabled
// Board mode BG_MODE = 0
outportb(0x406,0x02);
// Enable one-time counter for counting channel 0
outportb(0x411,0x00);
// Initialize counter (e.g., by setting to "00000000" with SW-CLEAR):
outportb(0x40E,0x00);
outportb(0x40F,0x00);
/************************************************************
** Main program
************************************************************/
// The status registers can be scanned cyclically in a loop to determine
// whether a zero-marking pulse has arrived on one of the counting channels.
// Zero-marking pulse arrived on channel 0?
Q0 = inportb(0x407) & 0x40;
58
SMP16-SFT251
©Siemens AG 2003, All Rights Reserved
(4)J31069-D2090-U001-A1-7618

Advertisement

Table of Contents
loading

This manual is also suitable for:

6ar1304-0ea00-0aa0

Table of Contents