N40P112 austriamicrosystems, N40P112 Datasheet - Page 10

no-image

N40P112

Manufacturer Part Number
N40P112
Description
SW NAV JOYSTICK MOD CONTACTLESS
Manufacturer
austriamicrosystems
Series
EasyPoint™r
Type
Navigation Switch, PCB Mountr
Datasheet

Specifications of N40P112

Output
Contactless Magnetic Switch
Switch Function
2 Axis with Select
Actuator Type
Joystick
Termination Style
SMD (SMT) Tab
Operating Force
35/180gf
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Contact Rating @ Voltage
-
EasyPoint
Datasheet - U s i n g t h e N 4 0 P 11 2 M o d u l e
8.3 C Source Code Example
8.3.1 Initialization
8.3.2 Offset Calibration
www.austriamicrosystems.com/N40P112
void EasyPoint_init (void)
{
}
void Offset_Calibrate (void)
{
}
unsigned char Reset_status = 0;
RESETn = 0;Delay_ms(1);// RESETn pulse after power up
RESETn = 1; Delay_ms(1);
while (Reset_status != 0xF0)// Check the reset has been done
{
}
I2C_Write8(0x40, 0x2d, 0x0D); // Scaling factor for N40 (1.0mm knob travel)
char i;
int x_cal=0, y_cal=0;
EA = 0;// Disable the MCU interrupts
I2C_Write8(0x40, 0x0F, 0x00);// Low Power Mode 20ms
Delay_ms(1);
I2C_Read8(0x40, 0x11); // Flush an unused Y_reg to reset the interrupt
for (i=0; i<16; i++)// Read 16 times the coordinates and then average
{
}
// offset_X and offset_Y are global variables, used for each coordinate readout
in the interrupt routine
offset_X = -(x_cal>>4); // Average X: divide by 16
offset_Y = -(y_cal>>4); // Average Y: divide by 16
EA = 1; // Enable the MCU interrupts
TM
N40P112
Reset_status = I2C_Read8(0x40, 0x0F) & 0xFE;
while (INTn);// Wait until next interrupt (new coordinates)
x_cal += (signed char) I2C_Read8(0x40, 0x10); // Read X position
y_cal += (signed char) I2C_Read8(0x40, 0x11); // Read Y position
Revision 1.1
10 - 34

Related parts for N40P112