Electronic Components Datasheet Search |
|
N40P112 Datasheet(PDF) 10 Page - ams AG |
|
N40P112 Datasheet(HTML) 10 Page - ams AG |
10 / 34 page EasyPoint TM N40P112 Datasheet - Using the N40P112 M odule www.austriamicrosystems.com/N40P112 Revision 1.1 10 - 34 8.3 C Source Code Example 8.3.1 Initialization void EasyPoint_init (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 { Reset_status = I2C_Read8(0x40, 0x0F) & 0xFE; } I2C_Write8(0x40, 0x2d, 0x0D); // Scaling factor for N40 (1.0mm knob travel) } 8.3.2 Offset Calibration void Offset_Calibrate (void) { 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 { 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 } // 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 } |
Similar Part No. - N40P112 |
|
Similar Description - N40P112 |
|
|
Link URL |
Privacy Policy |
ALLDATASHEET.COM |
Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Datasheet Upload | Contact us | Privacy Policy | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
Family Site : ic2ic.com |
icmetro.com |