NOTICE: 1, the timing for Start, Stop, ACK, NACK, write and read is same as I2C

Size: px
Start display at page:

Download "NOTICE: 1, the timing for Start, Stop, ACK, NACK, write and read is same as I2C"

Transcription

1 DPS01 USER GUIDE

2 DPS01 is a module which integrated digital atmospheric pressure altitude Temperature Compass weather forecast. No external components required It is a complete sensing system with on-chip signal processing and integrated I2C bus, allowing the device to be connected directly to a microprocessor, Features Supply voltage 2.4v-3.6v -20 C to + 70 C operating range Pressure sense:0.1hpa Pressure accuracy:±1.5hpa Pressure range:300hpa~1100hpa Altitude sense: 1m Altitude range:-698m~8948m Temperature sense:0.1 Temperature acuuracy:±0.5 Temperature range:-40 ~+85 Applications Pressure measurement and control systems Mobile altimeter/barometer systems Weather forecast products Adventure or multi-mode watches Electronic Compass GPS Navigation Position Sensing Vehicle Detection Magnetometry

3 NOTICE: 1, the timing for Start, Stop, ACK, NACK, write and read is same as I2C 2, the timing for write is : start + write 0x20 +ACK + write command + ACK + stop 3, the timing for read is : start + write 0x21 + ACK + read data1 + ACK + read data2+ ACK + read datax+ NACK + stop 4, for compass calibration, it will last for around 9.5s, during this period, it won t respond for any command. 5, For any command, if you don t get the ACK from the module, you must add the timeout (0.1s) in your program. And resend this command again till you got the right ACK. 6, When switch the write command to read command you need 200ms and 10ms for switch from read to write. 7, When you want the module to be in power save mode, you need to send the write command (0x71) 8, When wake up from sleep mode, you need to send write command (0x70), 9, For the frequency of I2C, you must be lower than 5KHz. 10,For the power supply it is limited to ( V) 11,For Data reading, the Highest byte is first and MSB in each byte. For example Start + 0x20 + ack + 0xa0 + ack + stop Delay 200ms Start + 0x21 + ack + 0x00 + ack + 0x03 + ack + 0x48+ NACK + stop The altitude got is 0x000348, and it is 84.0m 12, For temperature and altitude, the highest bit will show it is positive or negative. When the highest bit is 1, the value is negative. The other bit show the actual value. For example, for altitude, when the data got is 0x80111c, the actual altitude is : m. 13, For wakeup command, to make sure the wakeup command has been got correct, you d better send this command twice. 14, Too frequent reading of pressure,temperature, altitude, compass will increase the noise of the reading value, suggest you reading the pressure, temperature, altitude once per second or longer, and read the compass once every 0.4S. 15, The pressure sensor is very sensitive to the environment, if you don t want to show this fast changing reading, you can use below method to get the stable pressure reading. First read 8 times of the pressure value continuously, discard the maximum and minimum value, get the average of the rest 6 value, and take the average reading as the final reading. For example, the 8 times of the pressure reading is: , , , , ,

4 Then, discard and , the pressure reading = ( )/6 = , It is the same way as pressure when handle the altitude and temperature. Wake up command: Start + 0x20 + ACK_from _module + 0x70 + ACK_from_module + stop Delay 1s Sleep command Start + 0x20 + ACK_from _module + 0x71 + ACK_from_module + stop Delay 100ms Read altitude command Start + 0x20 + ACK_from _module + 0xa0 + ACK_from_module + stop Delay 200ms Start + 0x21 + ACK_from _module + Data1 + ACK_from_master + Data2 + ACK_from_master + Data3 + NACK_from_master + Stop Delay 10ms Read pressure command Start + 0x20 + ACK_from _module + 0xb0 + ACK_from_module + stop Delay 200ms Start + 0x21 + ACK_from _module + Data1 + ACK_from_master + Data2 + ACK_from_master + Data3 + NACK_from_master + Stop Delay 10ms Read weather forecast command Start + 0x20 + ACK_from _module + 0xb3 + ACK_from_module + stop Delay 200ms Start + 0x21 + ACK_from _module + Data1 + NACK_from_master + Stop Delay 10ms Read Compass command Start + 0x20 + ACK_from _module + 0xc0 + ACK_from_module + stop Delay 200ms Start + 0x21 + ACK_from _module + Data1 + ACK_from_master + Data2 + NACK_from_master + Stop Delay 10ms

5 Read Temperature command Start + 0x20 + ACK_from _module + 0x80 + ACK_from_module + stop Delay 200ms Start + 0x21 + ACK_from _module + Data1 + ACK_from_master + Data2 + NACK_from_master + Stop Delay 10ms Start Compass calibration command Start + 0x20 + ACK_from _module + 0xE0 + ACK_from_module + stop

6 DEMO PROGRAME #include<pic.h> #include<math.h> #define COMMUNI_SUCCEED 1 #define COMMUNI_FAILED 0 #define noack 0 #define ACK 1 #define PRESSURE_MODE 0 #define Temperature_MODE 1 #define ALTITUDE_MODE 2 #define COMPASS_MODE 3 #define WEATHER_MODE 4 #define POWER_OFF_MODE 5 #define MODE_KEY 0x1e// RA0 #define START_COMPASS_CALIBRATION_KEY 0x1d // RA1 #define EXIT_COMPASS_CALIBRATION_KEY 0x1b // RA2 #define POWER_ON_KEY 0x17 //RA3 #define POWER_OFF_KEY 0x0f //RA4 #define POWER_ON 0 #define POWER_OFF 1 #define COMPASS_CALIBRATION_COMMAND 0xe0 #define EXIT_COMPASS_CALIBRATION_COMMAND 0xe1 #define PRESS_WRITE_COMMAND 0xB0 #define TEMPERATURE_WRITE_COMMAND 0x80 #define ALTITUDE_WRITE_COMMAND 0xA0 #define COMPASS_WRITE_COMMAND 0xC0 #define WEATHER_WRITE_COMMAND 0xB3 #define MODULE_WAKEUP_WRITE_COMMAND 0X70 #define MODULE_SLEEP_WRITE_COMMAND 0X71

7 #define LED_A RD0 #define LED_B RD1 #define LED_C RD2 #define LED_D RD3 #define LED_E RD4 #define LED_F RD5 #define LED_G RD6 #define LED_DP RD7 #define LED_1 RB0 //RB0 //RA0 #define LED_2 RB1 //RB1 //RA1 #define LED_3 RB2 //RB2 #define LED_4 RB3 //RB3 //RA3 #define LED_5 RB4 //RB4 #define LED_6 RB5 //RB5 //RA3 #define SCK RC0 #define DATA RC1 #define DATA_SET TRISC1 #define DATA_INPUT 1 #define DATA_OUTPUT 0 #define DELAY100US 10 #define LED_ON 1 #define LED_OFF 0 #define LED_PEDO RC2 #define LED_TEMPERATURE RC3 #define LED_PRESSURE RC4 #define LED_ALTIDUTE RC5 #define LED_COMPASS RC6 #define LED_WEATHER RC7 // a b const unsigned char Tab_DispCoed[12]=0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff,0xbf; unsigned char DispData1; unsigned char DispData2; unsigned char DispData3; unsigned char DispData4; unsigned char DispData5; unsigned char DispData6;

8 unsigned char DispCount; unsigned char key; unsigned char mode; unsigned char press_h, press_m, press_l; unsigned char altitude_h, altitude_m, altitude_l; unsigned char weather; unsigned char compass_h, compass_l; unsigned char temperature_h, temperature_l; unsigned char communicate_status; unsigned long int cal_temp_ram; typedef struct unsigned char reach_1s : 1; unsigned char reach_5hz : 1; unsigned char temp_is_positive : 1; unsigned char is_disp_press : 1; unsigned char is_disp_altitude : 1; unsigned char is_disp_compass : 1; unsigned char is_disp_pedo : 1; unsigned char is_disp_temp : 1; unsigned char is_disp_weather : 1; FlagType; FlagType Flag; void port_init(void); void timer2_init(void);

9 void IIC_SCL_HIGH(void); void IIC_SCL_LOW(void); void IIC_Start(void); void IIC_Stop(void); void IIC_ACK(void); void IIC_NoAck(void); unsigned char IIC_ReadByte(void); unsigned char IIC_WriteByte( unsigned char ucdata ); void SysDelay1ms(unsigned int x); void SysDelay(unsigned int t); unsigned char key_scan_main_program(void); void pressure_led_display(void); void temperature_led_display(void); void altitude_led_display(void); void compass_led_display(void); void weather_led_display(void); void poweroff_led_display(void); void send_dps01_write_command(unsigned char command); void send_read_press_command(void); void send_read_altitude_command(void); void send_read_compass_command(void); void send_read_weather_command(void); void display_press(void); void display_altitude(void); void display_temperature(void); void display_compass(void); void display_weather(void); void key_handle_program(void); void mode_handle_program(void); void send_read_temperature_command(void); void display_compass_calibrate(void); void display_power_off(void); void main() OSCCON = 0X70; // 8M crystal WDTCON = 0X00;

10 DispCount = 2; SysDelay1ms(1000); timer2_init(); // port_init(); INTCON = 0xc0; // enable interrupt, 5MS 中断, 用于显示 DispData1 = 0x01; DispData2 = 0x02; DispData3 = 3; DispData4 = 4; DispData5 = 5; DispData6 = 6; send_dps01_write_command(module_wakeup_write_command); while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(module_wakeup_write_command); SysDelay1ms(1000); mode = PRESSURE_MODE; while(1) key = key_scan_main_program(); key_handle_program(); mode_handle_program(); unsigned char key_scan_main_program(void) unsigned char i,j; i = PORTA; i &= 0x1f; // only RA0 --RA4, normal high if ( i!= 0x1f) SysDelay1ms(30);

11 j = PORTA; j &= 0x1f; if(i == j) SysDelay1ms(100); return (i); // key pressed else return(0); else return(0); void timer2_init(void) T2CON = 0x7f; // timer2 on and 16 pre, postscale PR2 = 15;//156; // 50hZ*4, 4m/4/16/16/50 = 5ms TMR2IE = 1; NOP(); void interrupt ISR_timer(void) unsigned char i; if(tmr2if) switch(dispcount) case 2:

12 PORTD = Tab_DispCoed[DispData1]; LED_1 = LED_ON ; LED_2 = LED_OFF; LED_3 = LED_OFF; LED_4 = LED_OFF; LED_5 = LED_OFF; LED_6 = LED_OFF; break; DispCount <<= 1; case 4: PORTD = Tab_DispCoed[DispData2]; LED_1 = LED_OFF ; LED_2 = LED_ON; LED_3 = LED_OFF; LED_4 = LED_OFF; LED_5 = LED_OFF; LED_6 = LED_OFF; break; DispCount <<= 1; case 8: PORTD = Tab_DispCoed[DispData3]; LED_1 = LED_OFF ; LED_2 = LED_OFF; LED_3 = LED_ON; LED_4 = LED_OFF; LED_5 = LED_OFF; LED_6 = LED_OFF; break; DispCount <<= 1; case 16: PORTD = Tab_DispCoed[DispData4]; if(flag.is_disp_press) PORTD &= 0x7f; // display dot LED_1 = LED_OFF ;

13 LED_2 = LED_OFF; LED_3 = LED_OFF; LED_4 = LED_ON; LED_5 = LED_OFF; LED_6 = LED_OFF; DispCount <<= 1; break; case 32: PORTD = Tab_DispCoed[DispData5]; if((flag.is_disp_temp) (Flag.is_disp_altitude)) PORTD &= 0x7f; // display dot LED_1 = LED_OFF ; LED_2 = LED_OFF; LED_3 = LED_OFF; LED_4 = LED_OFF; LED_5 = LED_ON; LED_6 = LED_OFF; DispCount <<= 1; break; case 64: PORTD = Tab_DispCoed[DispData6]; LED_1 = LED_OFF ; LED_2 = LED_OFF; LED_3 = LED_OFF; LED_4 = LED_OFF; LED_5 = LED_OFF; LED_6 = LED_ON; DispCount = 2; break; TMR2IF=0; void port_init(void) ANSELA = 0; ANSELB = 0;

14 ANSELD = 0; ANSELE = 0; TRISA = 0xFF; // RA PORT IS INPUT ( KEY + OSC) TRISB = 0x00; // rb IS OUTPTU TRISC = 0X00; // PORT C IS OUTPUT TRISD = 0X0; // PORT D IS OUTPUT TRISE = 0x00; // PORTE is output PORTB = PORTC = PORTD= PORTE = 0xff; // all port is high //================================================ void SysDelay(unsigned int t) t *= 2; for(;t>0;t--) #asm NOP NOP NOP NOP NOP NOP NOP #endasm //================================================ void SysDelay1ms(unsigned int x) unsigned char i; x *= 2; for (; x>0; x--) for(i = 200; i>1; i--)

15 NOP(); void pressure_led_display(void) LED_PRESSURE = 1; LED_ALTIDUTE = 0; LED_TEMPERATURE = 0; LED_COMPASS = 0; LED_WEATHER = 0; LED_PEDO = 0; void temperature_led_display(void) LED_PRESSURE = 0; LED_ALTIDUTE = 0; LED_TEMPERATURE = 1; LED_COMPASS = 0; LED_WEATHER = 0; LED_PEDO = 0; void altitude_led_display(void) LED_PRESSURE = 0; LED_ALTIDUTE = 1; LED_TEMPERATURE = 0; LED_COMPASS = 0; LED_WEATHER = 0; LED_PEDO = 0; void compass_led_display(void) LED_PRESSURE = 0; LED_ALTIDUTE = 0; LED_TEMPERATURE = 0; LED_COMPASS = 1; LED_WEATHER = 0;

16 LED_PEDO = 0; void weather_led_display(void) LED_PRESSURE = 0; LED_ALTIDUTE = 0; LED_TEMPERATURE = 0; LED_COMPASS = 0; LED_WEATHER = 1; LED_PEDO = 0; void poweroff_led_display(void) LED_PRESSURE = 0; LED_ALTIDUTE = 0; LED_TEMPERATURE = 0; LED_COMPASS = 0; LED_WEATHER = 0; LED_PEDO = 0; void key_handle_program(void) switch(key) case MODE_KEY: if(mode == POWER_OFF_MODE) mode = 0; else mode ++; if(mode == 0x05) mode = 0; break; case POWER_ON_KEY:

17 mode = PRESSURE_MODE; send_dps01_write_command(module_wakeup_write_command); while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(module_wakeup_write_command); SysDelay1ms(200); break; case POWER_OFF_KEY: mode = POWER_OFF_MODE; display_power_off(); poweroff_led_display(); send_dps01_write_command(module_sleep_write_command); while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(module_sleep_write_command); SysDelay1ms(200); break; case START_COMPASS_CALIBRATION_KEY: display_compass_calibrate(); mode = COMPASS_MODE; send_dps01_write_command(compass_calibration_command); while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(compass_calibration_command); break; case EXIT_COMPASS_CALIBRATION_KEY: mode = COMPASS_MODE; send_dps01_write_command(exit_compass_calibration_command);

18 while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(exit_compass_calibration_command); break; void mode_handle_program(void) if(mode == PRESSURE_MODE) pressure_led_display(); send_dps01_write_command(press_write_command); while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(press_write_command); SysDelay1ms(200); send_read_press_command(); display_press(); SysDelay1ms(10); else if(mode == Temperature_MODE) temperature_led_display(); send_dps01_write_command(temperature_write_command); while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(temperature_write_command); SysDelay1ms(200); send_read_temperature_command(); display_temperature(); SysDelay1ms(10); else if(mode == ALTITUDE_MODE)

19 altitude_led_display(); send_dps01_write_command(altitude_write_command); while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(altitude_write_command); SysDelay1ms(200); send_read_altitude_command(); display_altitude(); SysDelay1ms(10); else if(mode == COMPASS_MODE) compass_led_display(); send_dps01_write_command(compass_write_command); while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(compass_write_command); SysDelay1ms(100); send_read_compass_command(); display_compass(); SysDelay1ms(10); else if(mode == WEATHER_MODE) weather_led_display(); send_dps01_write_command(weather_write_command); while( communicate_status!= COMMUNI_SUCCEED) send_dps01_write_command(weather_write_command); SysDelay1ms(200); send_read_weather_command(); display_weather(); SysDelay1ms(10); void display_press(void)

20 unsigned long int j; Flag.is_disp_press = 1; Flag.is_disp_altitude = 0; Flag.is_disp_compass = 0; Flag.is_disp_pedo = 0; Flag.is_disp_temp = 0; Flag.is_disp_weather = 0; NOP(); cal_temp_ram = press_h; cal_temp_ram *= 256; cal_temp_ram *= 256; cal_temp_ram += (unsigned int)(press_m <<8); cal_temp_ram += press_l; DispData6 = cal_temp_ram%10; j= cal_temp_ram/10; DispData5 = j%10; j= cal_temp_ram/100; DispData4 = j%10; j= cal_temp_ram/1000; DispData3 = j%10; j= cal_temp_ram/10000; DispData2 = j%10; j= cal_temp_ram/100000; DispData1 = j%10; if(dispdata1 ==0) DispData1 = 0x0a; if( DispData2 ==0) DispData2 = 0x0a;

21 void display_altitude(void) unsigned long int i, j; Flag.is_disp_press = 0; Flag.is_disp_altitude = 1; Flag.is_disp_compass = 0; Flag.is_disp_pedo = 0; Flag.is_disp_temp = 0; Flag.is_disp_weather = 0; if((altitude_h &0x80) ==0x80) DispData1= 0x0b ; // display - altitude is negative altitude_h &= 0x7f; else DispData1= 0x0a ; i = altitude_h; i <<= 8; i <<= 8; i += (unsigned int)(altitude_m <<8); i += altitude_l; DispData6 = i%10; j= i/10; DispData5 = j%10; j= i/100; DispData4 = j%10; j= i/1000; DispData3 = j%10; j= i/10000; DispData2 = j%10;

22 if( DispData2 ==0) DispData2 = 0x0a; if( DispData3 ==0 ) DispData3 = 0x0a; if(dispdata4 == 0x0) DispData4 = 0x0a; void display_temperature(void) unsigned int i, j; Flag.is_disp_press = 0; Flag.is_disp_altitude = 0; Flag.is_disp_compass = 0; Flag.is_disp_pedo = 0; Flag.is_disp_temp = 1; Flag.is_disp_weather = 0; if((temperature_h &0x80) ==0x80) DispData1= 0x0b ; // display -,temperature is negative temperature_h &= 0x7f; else DispData1= 0x0a ; i =(unsigned int)( temperature_h<<8); i += temperature_l; DispData6 = i%10; j= i/10; DispData5 = j%10; j= i/100;

23 DispData4 = j%10; j= i/1000; DispData3 = j%10; j= i/10000; DispData2 = j%10; if( DispData2 ==0) DispData2 = 0x0a; if( DispData3 ==0 ) DispData3 = 0x0a; if(dispdata4 == 0x0) DispData4 = 0x0a; void display_compass(void) unsigned int i, j; Flag.is_disp_press = 0; Flag.is_disp_altitude = 0; Flag.is_disp_compass = 1; Flag.is_disp_pedo = 0; Flag.is_disp_temp = 0; Flag.is_disp_weather = 0; i = (unsigned int)(compass_h<<8); i += compass_l; DispData6 = i%10; j= i/10; DispData5 = j%10; j= i/100; DispData4 = j%10; DispData1 = 0x0a;

24 DispData2 = 0x0a; DispData3 = 0x0a; void display_power_off(void) Flag.is_disp_press = 0; Flag.is_disp_altitude = 0; Flag.is_disp_compass = 0; Flag.is_disp_pedo = 0; Flag.is_disp_temp = 0; Flag.is_disp_weather = 0; DispData6 = 0x0a; DispData5 = 0x0a; DispData4 = 0x0a; DispData1 = 0x0a; DispData2 = 0x0a; DispData3 = 0x0a; void display_compass_calibrate(void) Flag.is_disp_press = 0; Flag.is_disp_altitude = 0; Flag.is_disp_compass = 1; Flag.is_disp_pedo = 0; Flag.is_disp_temp = 0; Flag.is_disp_weather = 0; DispData6 = 0x0b; DispData5 = 0x0b; DispData4 = 0x0b; DispData1 = 0x0a; DispData2 = 0x0a; DispData3 = 0x0a;

25 void display_weather(void) Flag.is_disp_press = 0; Flag.is_disp_altitude = 0; Flag.is_disp_compass = 0; Flag.is_disp_pedo = 0; Flag.is_disp_temp = 0; Flag.is_disp_weather = 1; DispData1 = 0x0a; DispData2 = 0x0a; DispData3 = 0x0a; DispData4 = 0x0a; DispData5 = 0x0a; DispData6 = weather; void send_dps01_write_command(unsigned char command) IIC_Start(); communicate_status = IIC_WriteByte(0x20); if( communicate_status == COMMUNI_SUCCEED) communicate_status = IIC_WriteByte(command); if( communicate_status == COMMUNI_SUCCEED) IIC_Stop(); void send_read_press_command(void) IIC_Start(); communicate_status = IIC_WriteByte(0x21); if( communicate_status == COMMUNI_SUCCEED)

26 press_h = IIC_ReadByte(); IIC_ACK(); press_m = IIC_ReadByte(); IIC_ACK(); press_l = IIC_ReadByte(); IIC_NoAck(); IIC_Stop(); void send_read_temperature_command(void) IIC_Start(); communicate_status = IIC_WriteByte(0x21); if( communicate_status == COMMUNI_SUCCEED) temperature_h = IIC_ReadByte(); IIC_ACK(); temperature_l = IIC_ReadByte(); IIC_NoAck(); IIC_Stop(); void send_read_altitude_command(void) IIC_Start(); communicate_status = IIC_WriteByte(0x21); if( communicate_status == COMMUNI_SUCCEED) altitude_h = IIC_ReadByte(); IIC_ACK(); altitude_m = IIC_ReadByte(); IIC_ACK(); altitude_l = IIC_ReadByte(); IIC_NoAck(); IIC_Stop();

27 void send_read_compass_command(void) IIC_Start(); communicate_status = IIC_WriteByte(0x21); if( communicate_status == COMMUNI_SUCCEED) compass_h = IIC_ReadByte(); IIC_ACK(); compass_l = IIC_ReadByte(); IIC_NoAck(); IIC_Stop(); void send_read_weather_command(void) IIC_Start(); communicate_status = IIC_WriteByte(0x21); if( communicate_status == COMMUNI_SUCCEED) weather = IIC_ReadByte(); IIC_NoAck(); IIC_Stop(); //================================================ void IIC_SCL_HIGH(void) SCK=1; //================================================ void IIC_SCL_LOW(void) SCK=0;

28 void IIC_Start(void) DATA_SET = DATA_OUTPUT; DATA=1; IIC_SCL_HIGH(); DATA=0; IIC_SCL_LOW(); //================================================ void IIC_Stop(void) DATA_SET = DATA_OUTPUT; IIC_SCL_LOW(); DATA=0; IIC_SCL_HIGH(); DATA=1; //================================================ void IIC_ACK(void) DATA_SET = DATA_OUTPUT; DATA=0; IIC_SCL_HIGH();

29 IIC_SCL_LOW(); //================================================ void IIC_NoAck(void) DATA_SET = DATA_OUTPUT; DATA=1; IIC_SCL_HIGH(); IIC_SCL_LOW(); //================================================ unsigned char IIC_ReadByte(void) unsigned char ucvalue; unsigned char ucindex; ucvalue = 0; DATA_SET = DATA_INPUT; for ( ucindex = 0; ucindex < 8; ucindex++ ) ucvalue <<= 1; IIC_SCL_LOW();

30 IIC_SCL_HIGH(); if(data) ucvalue = 1; IIC_SCL_LOW(); return ucvalue; //================================================ unsigned char IIC_WriteByte( unsigned char ucdata ) unsigned char i; DATA_SET = DATA_OUTPUT; for( i = 0; i < 8; i++ ) IIC_SCL_LOW(); if((ucdata & 0x80) == 0x80) DATA=1; else DATA=0; IIC_SCL_HIGH(); ucdata <<= 1; IIC_SCL_LOW();

31 DATA_SET = DATA_INPUT; IIC_SCL_LOW(); IIC_SCL_HIGH(); if( DATA!= 0) IIC_SCL_LOW(); SysDelay1ms(10); return(communi_failed); else IIC_SCL_LOW(); return(communi_succeed); // end

Tel: Fax:

Tel: Fax: /****************************************************************************** Title: RFM22 transmitter demo program Current version: V1.2 Function: Package send Demo Processor PIC16F690 DIP-20 Clock:

More information

HP03 programming guide

HP03 programming guide HP03 programming guide 1. Brief description The HP03 is a low power device, include a piezo-resistive pressure senor and an ADC interface. It provide 16 bit da ta for pressure and t emperature re late

More information

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag Timer0..Timer3 Timers are pretty useful: likewise, Microchip provides four different timers for you to use. Like all interrupts, you have to Enable the interrupt, Set the conditions of the interrupt, and

More information

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*the speed the cell which are less dense can float and the cell that are denser can sink*/ /*the user has five

More information

Speed Control of a DC Motor using Digital Control

Speed Control of a DC Motor using Digital Control Speed Control of a DC Motor using Digital Control The scope of this project is threefold. The first part of the project is to control an LCD display and use it as part of a digital tachometer. Secondly,

More information

ECE Homework #10

ECE Homework #10 Timer 0/1/2/3 ECE 376 - Homework #10 Timer 0/1/2/3, INT Interrupts. Due Wednesday, November 14th, 2018 1) Write a program which uses INT and Timer 0/1/2/3 interrupts to play the cord C#major for 1.000

More information

Timer1 Capture Mode:

Timer1 Capture Mode: Timer1 Capture Mode: Interrupt Description Input Conditions Enable Flag Timer 1 Trigger after N events N = 1.. 2 19 100ns to 0.52 sec RC0 TMR1CS = 1 TMR1IF Timer 1 Capture Mode 1 Timer 1 Capture Mode 2

More information

Microcontroller Overview

Microcontroller Overview Microcontroller Overview Microprocessors/Microcontrollers/DSP Microcontroller components Bus Memory CPU Peripherals Programming Microcontrollers vs. µproc. and DSP Microprocessors High-speed information

More information

BME 4900 Page 1 of 2. Meeting 2: Personal Progress Report 12/2/09 Team 12 with Drew Seils. Semester One Week Two

BME 4900 Page 1 of 2. Meeting 2: Personal Progress Report 12/2/09 Team 12 with Drew Seils. Semester One Week Two BME 4900 Page 1 of 2 Semester One Week Two These past two saw a lot of progress with the Revo stationary bike project. During Thanksgiving break Shane spent most of his time doing research for the power

More information

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background:

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background: Background: Timer2 Interrupts The execution time for routines sometimes needs to be set. This chapter loops at several ways to set the sampling rate. Example: Write a routine which increments an 8-bit

More information

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

EE6008-Microcontroller Based System Design Department Of EEE/ DCE UNIT- II INTERRUPTS AND TIMERS PART A 1. What are the interrupts available in PIC? (Jan 14) Interrupt Source Enabled by Completion Status External interrupt from INT INTE = 1 INTF = 1 TMR0 interrupt T0IE

More information

Analog Output with a Digital to Analog Converter

Analog Output with a Digital to Analog Converter Analog Output with a Digital to Analog Converter Matthew Beckler beck0778@umn.edu EE2361 Lab 007 April 5, 2006 Abstract Without help, microcontrollers can have great trouble creating analog signals. Approximations

More information

More Fun with Timer Interrupts

More Fun with Timer Interrupts More Fun with Timer Interrupts Chords Objective: Play a musical chord each time you press a button: Button RC0 RC1 RC2 Timer Timer0 Timer1 Timer3 RB0 A3 C4 E4 RB1 B3 D4 F4 RB2 C4 E4 G4 Calculations: Assume

More information

SRF08 Ultra sonic range finder

SRF08 Ultra sonic range finder SRF08 Ultra sonic range finder Technical Specification Communication with the SRF08 ultrasonic rangefinder is via the I2C bus. This is available on popular controllers such as the OOPic and Stamp BS2p,

More information

LCDs. Embedded Systems Interfacing. 20 September 2011

LCDs. Embedded Systems Interfacing. 20 September 2011 20 September 2011 How Polarizers Work How work How Color Work Other Technologies Reflective Nematic (no back light) Cholesteric Liquid Crystal Organic LED/Polymer LED Vacuum Florescent Display Display

More information

Flow Charts and Assembler Programs

Flow Charts and Assembler Programs Flow Charts and Assembler Programs Flow Charts: A flow chart is a graphical way to display how a program works (i.e. the algorithm). The purpose of a flow chart is to make the program easier to understand.

More information

ALFRED MAZHINDU

ALFRED MAZHINDU SENSORS AND ACTUATORS LAB_2 ALFRED MAZHINDU 09022270 DATA ACQUISITION FROM AN OPTICAL SENSOR LABORATORY STAGE 2_10/11 Contents Table of Figures... 2 Lab: Data acquisition from an optical sensor... 3 Introduction...

More information

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 6 Experiment 6:Timers Objectives To become familiar with hardware timing

More information

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University PIC ming in C and Assembly Outlines Microprocessor vs. MicroController PIC in depth PIC ming Assembly ming Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University Embedded C

More information

LCD. Configuration and Programming

LCD. Configuration and Programming LCD Configuration and Programming Interfacing and Programming with Input/Output Device: LCD LCD (liquid crystal display) is specifically manufactured to be used with microcontrollers, which means that

More information

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller 8. Microcontroller Textbook Programming Robot Controllers, Myke Predko, McGraw Hill. Reference PIC Robotics: A Beginner's Guide to Robotics Projects Using the PIC Micro, John Iovine, McGraw Hill. Embedded

More information

Team 8: Robert Blake Craig Goliber Alanna Ocampo

Team 8: Robert Blake Craig Goliber Alanna Ocampo Team 8: Robert Blake Craig Goliber Alanna Ocampo Objective of the design CAD Presentation Microcontroller Implementation PCB Design Design Limitations Conclusion Problem: Design a centrifuge which was

More information

Embedded System Design

Embedded System Design ĐẠI HỌC QUỐC GIA TP.HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA ĐIỆN-ĐIỆN TỬ BỘ MÔN KỸ THUẬT ĐIỆN TỬ Embedded System Design : Microcontroller 1. Introduction to PIC microcontroller 2. PIC16F84 3. PIC16F877

More information

Interrupts on PIC18F252 Part 2

Interrupts on PIC18F252 Part 2 Interrupts on PIC18F252 Part 2 Following pages list Special Function Registers (SFRs) involved in interrupt configuration and operation on PIC18F252 microcontroller. (Copied from Microchip s PIC18Fxx2

More information

EE 361L Digital Systems and Computer Design Laboratory

EE 361L Digital Systems and Computer Design Laboratory EE 361L Digital Systems and Computer Design Laboratory University of Hawaii Department of Electrical Engineering by Galen Sasaki and Ashok Balusubramaniam Quick Overview of PIC16F8X Version 1.0 Date: 9/4/01

More information

CAN / RS485. Product Description. Technical Reference Note. Interface Adapter. Special Features

CAN / RS485. Product Description. Technical Reference Note. Interface Adapter. Special Features CAN / Interface Adapter For SHP Series Total Power: < 1 Watts Input Voltage: 5V Internal Outputs: CAN,, USB, I 2 C Special Features Input Protocols: 1) using Modbus 2) CAN using modified Modbus Output

More information

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13)

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13) C and Embedded Systems A µp-based system used in a device (i.e, a car engine) performing control and monitoring functions is referred to as an embedded system. The embedded system is invisible to the user

More information

Binary Outputs and Timing

Binary Outputs and Timing Binary Outputs and Timing Each of the I/O pins on a PIC can be inputs or ourputs As an input, the pin is high impedance (meaning it is passive and draws very little current). If you apply 0V to that pin,

More information

Application Note One Wire Digital Output. 1 Introduction. 2 Electrical Parameters for One Wire Interface. 3 Start and Data Transmission

Application Note One Wire Digital Output. 1 Introduction. 2 Electrical Parameters for One Wire Interface. 3 Start and Data Transmission Application Note One Wire Digital Output 1 Introduction The pressure transmitter automatically outputs pressure data, and when appropriate temperature data, in a fixed interval. The host simply waits for

More information

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch. Introduction to microprocessors Feisal Mohammed 3rd January 2001 Additional features 1 Input/Output Ports One of the features that differentiates a microcontroller from a microprocessor is the presence

More information

MicroToys Guide: PS/2 Mouse N. Pinckney April 2005

MicroToys Guide: PS/2 Mouse N. Pinckney April 2005 Introduction A computer mouse provides an excellent device to acquire 2D coordinate-based user input, since most users are already familiar with it. Most mice usually come with two or three buttons, though

More information

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12 Chapter 9 Input/Output (I/O) Ports and Interfacing Updated: 3/13/12 Basic Concepts in I/O Interfacing and PIC18 I/O Ports (1 of 2) I/O devices (or peripherals) such as LEDs and keyboards are essential

More information

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4 Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 1, 2016 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F648A processor,

More information

Introduction. Embedded system functionality aspects. Processing. Storage. Communication. Transformation of data Implemented using processors

Introduction. Embedded system functionality aspects. Processing. Storage. Communication. Transformation of data Implemented using processors Input/Output 1 Introduction Embedded system functionality aspects Processing Transformation of data Implemented using processors Storage Retention of data Implemented using memory Communication Transfer

More information

80C51 Block Diagram. CSE Overview 1

80C51 Block Diagram. CSE Overview 1 80C51 Block Diagram CSE 477 8051 Overview 1 80C51 Memory CSE 477 8051 Overview 3 8051 Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits i.e. addresses for only 256 bytes! PC is

More information

HDPM01. Description. Features. Applications

HDPM01. Description. Features. Applications Integrated pressure sensor 300-1100hpa absolute Pressure Range ROHS compliant 11 coefficients for software compensation stored on chip Full integration of 2-axis magnetic sensors and electronics circuits

More information

Dallas Semiconductor DS1307 Real Time Clock. The DS 1307 is a real-time clock with 56 bytes of NV (nonvolatile)

Dallas Semiconductor DS1307 Real Time Clock. The DS 1307 is a real-time clock with 56 bytes of NV (nonvolatile) Using the MC9S12 IIC Bus with DS 1307 Real Time Clock DS1307 Data Sheet Asynchronous Serial Communications The MC9S12 Serial Communications Interface (SCI) Dallas Semiconductor DS1307 Real Time Clock The

More information

C-CODE EXAMPLE FOR SCP1000-D01 PRESSURE SENSOR

C-CODE EXAMPLE FOR SCP1000-D01 PRESSURE SENSOR C-CODE EXAMPLE FOR SCP1000-D01 PRESSURE SENSOR 1 INTRODUCTION The objective is to set up SPI communication between VTI Technologies' digital pressure sensor component and an MCU of an application device.

More information

Embedded Systems. PIC16F84A Sample Programs. Eng. Anis Nazer First Semester

Embedded Systems. PIC16F84A Sample Programs. Eng. Anis Nazer First Semester Embedded Systems PIC16F84A Sample Programs Eng. Anis Nazer First Semester 2017-2018 Development cycle (1) Write code (2) Assemble / compile (3) Simulate (4) Download to MCU (5) Test Inputs / Outputs PIC16F84A

More information

Lab Report for Sensor Calibration using a PIC16F84 GROUP MEMBERS ALFRED MAZHINDU SIMBARASHE CHIWESHE

Lab Report for Sensor Calibration using a PIC16F84 GROUP MEMBERS ALFRED MAZHINDU SIMBARASHE CHIWESHE CY-0205M Sensor and Actuators Lab Report for Sensor Calibration using a PIC16F84 GROUP MEMBERS ALFRED MAZHINDU - 09022270 SIMBARASHE CHIWESHE - 09016352 Alfred Mazhindu & Simbarashe Chiweshe Page 1 CONTENTS

More information

Protocol of data exchange with modem via USB interface Version

Protocol of data exchange with modem via USB interface Version Protocol of data exchange with modem via USB interface Version 2017.12.19 - Modem connects to USB-host as USB device of CDC class (virtual COM port in Windows, ttyusb or ttyacm in Linux) - Because real

More information

DIGITAL HUMIDITY SENSOR HYT-131

DIGITAL HUMIDITY SENSOR HYT-131 Rights reserved for change in technical data! B+B Thermo-Technik GmbH Postfach 1748 D-78158 Donaueschingen Phone: +49 771 8316-622 Fax: +49 771 8316-629 DIGITAL HUMIDITY SENSOR 1. Features - On-Chip humidity

More information

App Note Application Note: State-Driven Control of a dpasp using a Microchip PIC.

App Note Application Note: State-Driven Control of a dpasp using a Microchip PIC. Rev: 1.0.1 Date: 8 th July 2009 App Note - 207 Application Note: State-Driven Control of a dpasp using a Microchip PIC. This application note contains a total 3 files, if you have only this pdf text document,

More information

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS Interfacing to an LCD Module AN587 INTRODUCTION TABLE 1: CONTROL SIGNAL FUNCTIONS This application note interfaces a PIC16CXX device to the Hitachi LM02L LCD character display module. This module is a

More information

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Philadelphia University Faculty of Engineering Course Title: Embedded Systems (630414) Instructor: Eng. Anis Nazer Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Student Name: Student

More information

Conto D2 COMMUNICATION PROTOCOL CONTENTS 1.0 INTRODUCTION

Conto D2 COMMUNICATION PROTOCOL CONTENTS 1.0 INTRODUCTION PR 121 rev. 0 11/11/2011 Pagina 1 di 9 ELECTRICITY ENERGY METER FIRMWARE 1.6 Conto D2 COMMUNICATION PROTOCOL CONTENTS 1.0 INTRODUCTION 2.0 DATA MESSAGE DESCRIPTION 2.1 Data field description 2.2 Data format

More information

C Language Programming, Interrupts and Timer Hardware

C Language Programming, Interrupts and Timer Hardware C Language Programming, Interrupts and Timer Hardware In this sequence of three labs, you will learn how to write simple C language programs for the MC9S12 microcontroller, and how to use interrupts and

More information

PIC Microcontroller Introduction

PIC Microcontroller Introduction PIC Microcontroller Introduction The real name of this microcontroller is PICmicro (Peripheral Interface Controller), but it is better known as PIC. Its first ancestor was designed in 1975 by General Instruments.

More information

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF.

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. Interrupts The Real Time Interrupt Interrupt vectors for the 68HC912B32 The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. These vectors are programmed into Flash EEPROM

More information

Programming Guide I2C Bus

Programming Guide I2C Bus Programming Guide I2C Bus S-Series, T-Series models cdg, 2016. 6. T: +082-32-719-8055 E-mail: cdg@eltsensor.co.kr www.eltsensor.co.kr Contents 1. Applied Models 2. Compare of each model 3. I2C Frame Sequence

More information

Embedding it better... µtasker Document. µtasker I 2 C Support, Demo and Simulation

Embedding it better... µtasker Document. µtasker I 2 C Support, Demo and Simulation Embedding it better... µtasker Document µtasker I 2 C Support, Demo and Simulation utasker_i2c.doc/0.06 Copyright 2017 M.J.Butcher Consulting Table of Contents 1. Introduction...3 2. Example - EEPROM...3

More information

chip1controller /* * SeniorDesignI2C.c * * Created: 11/24/2014 6:54:26 PM * Author: Robert Bower / Alonzo Ubilla * Chip 1 control */

chip1controller /* * SeniorDesignI2C.c * * Created: 11/24/2014 6:54:26 PM * Author: Robert Bower / Alonzo Ubilla * Chip 1 control */ /* * SeniorDesignI2C.c * * Created: 11/24/2014 6:54:26 PM * Author: Robert Bower / Alonzo Ubilla * Chip 1 control */ #include #include #include #include "TWI_slave.h"

More information

Laboratory 10. Programming a PIC Microcontroller - Part II

Laboratory 10. Programming a PIC Microcontroller - Part II Laboratory 10 Programming a PIC Microcontroller - Part II Required Components: 1 PIC16F88 18P-DIP microcontroller 1 0.1 F capacitor 3 SPST microswitches or NO buttons 4 1k resistors 1 MAN 6910 or LTD-482EC

More information

Altimeter / Barometer Module SMD500 ultra low power, low voltage

Altimeter / Barometer Module SMD500 ultra low power, low voltage Altimeter / Barometer Module SMD500 ultra low power, low voltage 1. General Description The SMD500 marks a new generation of high precision digital pressure sensors for consumer applications. Its ultra

More information

ET-PIC 24 WEB-V1. o Central Processing Unit (CPU) o System. o nanowatt Power Managed Modes. o Analog Features

ET-PIC 24 WEB-V1. o Central Processing Unit (CPU) o System. o nanowatt Power Managed Modes. o Analog Features ET-PIC 24 WEB-V1 ET-PIC 24 WEB-V1 is PIC Board Microcontroller from Microchip that uses 16 Bit No.PIC24FJ128GA008 Microcontroller for processing data and develops board. The remarkable specification of

More information

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application... Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 19, 2011 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F684A processor,

More information

Table of Contents COMPANY PROFILE 1-1 SECTION 1. INTRODUCTION 1-1

Table of Contents COMPANY PROFILE 1-1 SECTION 1. INTRODUCTION 1-1 COMPANY PROFILE 1-1 SECTION 1. INTRODUCTION 1-1 Introduction... 1-2 Manual Objective... 1-3 Device Structure... 1-4 Development Support... 1-6 Device Varieties... 1-7 Style and Symbol Conventions... 1-12

More information

OEM-ORP ORP. Reads mV mV. Range. 1 reading every 420ms. Response time. Any type & brand. Supported probes. Single point.

OEM-ORP ORP. Reads mV mV. Range. 1 reading every 420ms. Response time. Any type & brand. Supported probes. Single point. V 2.3 Revised /23/18 OEM-ORP Embedded ORP Circuit Reads Range Response time ORP -19.9mV 19.9mV 1 reading every 420ms Supported probes Calibration Temp compensation Data protocol Default I 2 C address Operating

More information

/* PROGRAM FOR BLINKING LEDs CONEECTED TO PORT-D */

/* PROGRAM FOR BLINKING LEDs CONEECTED TO PORT-D */ /* PROGRAM FOR BLINKING LEDs CONEECTED TO PORT-D */ CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF ;***** VARIABLE DEFINITIONS COUNT_L EQU 0x01 ;**********************************************************************

More information

Lecture (03) PIC16F84 (2)

Lecture (03) PIC16F84 (2) Lecture (03) PIC16F84 (2) By: Dr. Ahmed ElShafee ١ PIC16F84 has a RISC architecture, or Harvard architecture in another word ٢ PIC16F84 belongs to a class of 8 bit microcontrollers of RISC architecture.

More information

Specification E2 Interface

Specification E2 Interface Specification E2 Interface Version 4.1 Name Date Created: Robert Mayr. 15.04.2011 Checked: Haider A. 15.04.2011 Approved: Reason for change: Text corrections TABLE OF CONTENTS 1 INTRODUCTION... 3 1.1 Overview..................................................................................................................

More information

SRF02 Ultrasonic range finder Technical Specification

SRF02 Ultrasonic range finder Technical Specification SRF02 Ultrasonic range finder Technical Specification I2C Mode For Serial mode click here I2C Communication To use the SRF02 in I2C mode, make sure nothing is connected to the mode pin, it must be left

More information

I 2 C Application Note in Protocol B

I 2 C Application Note in Protocol B I 2 C Application Note in Protocol B Description This document is a reference for a possible coding method to achieve pressure, temperature, and status for SMI part readings using I 2 C. This SMI Protocol

More information

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to

More information

C Language Programming, Interrupts and Timer Hardware

C Language Programming, Interrupts and Timer Hardware C Language Programming, Interrupts and Timer Hardware In this sequence of three labs, you will learn how to write simple C language programs for the MC9S12 microcontroller, and how to use interrupts and

More information

VZ8(6)9 rev B I2C communication quick manual. SGX Sensortech

VZ8(6)9 rev B I2C communication quick manual. SGX Sensortech VZ8(6)9 rev B I2C communication quick manual 1. VZ PCBA considerations External pull-up restors (4k7) are required on SDA And SCL (they are not implemented on VZ PCBA) VDD for VZ8(6)9T = 3V3 VDD for VZ8(6)9F

More information

Input/Output Ports and Interfacing

Input/Output Ports and Interfacing Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning Basic I/O Concepts Peripherals such as LEDs and keypads are essential

More information

EE 354 September 16, 2016 C Sample Programs

EE 354 September 16, 2016 C Sample Programs EE 354 September 16, 2016 C Sample Programs //DataArray /* This program creates an array of data in code memory * that is 32 bytes long. Fill this array with the ascii codes for * the capital letters plus

More information

COMMUNICATION MODBUS PROTOCOL

COMMUNICATION MODBUS PROTOCOL COMMUNICATION MODBUS PROTOCOL CE4DMID31 / CE4DMID21 CONTO D4 Pd MID PR123 20/10/2016 Pag. 1/9 Contents 1.0 ABSTRACT... 2 2.0 DATA MESSAGE DESCRIPTION... 3 2.1 Parameters description... 3 2.2 Data format...

More information

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly. More on Programming the 9S12 in C Huang Sections 5.2 through 5.4 Introduction to the MC9S12 Hardware Subsystems Huang Sections 8.2-8.6 ECT_16B8C Block User Guide A summary of MC9S12 hardware subsystems

More information

MM Update for A3222Q56

MM Update for A3222Q56 MM Update for A3222Q56 New Features: SPI-A3222 Interface; I2C to SHA256 Special Channel; I2C Data Interface; Support Firmware Reload Protocol; DNA Read Interface; 1. alink 1.1 FSM IDLE FIFO Chip_num WORK

More information

CHAPTER 1 - World of microcontrollers

CHAPTER 1 - World of microcontrollers CHAPTER 1 - World of microcontrollers One Time Programmable ROM (OTP ROM) One time programmable ROM enables you to download a program into it, but, as its name states, one time only. If an error is detected

More information

APPLICATION NOTE 5306 Programming Baud Rates of the MAX3108 UART

APPLICATION NOTE 5306 Programming Baud Rates of the MAX3108 UART Maxim > Design Support > Technical Documents > Application Notes > Interface Circuits > APP 5306 Keywords: UART, RS232, RS485, SPI, I2C, half duplex, HDX, full duplex, FDX, WLP, wafer level package, FIFO,

More information

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed EE25M Introduction to microprocessors original author: Feisal Mohammed updated: 18th February 2002 CLR Part V Hardware Interfacing There are several features of computers/microcontrollers which have not

More information

This technical note is intended to provide information about the proper power-on procedure of the Kionix KMX62, KMX63 sensors.

This technical note is intended to provide information about the proper power-on procedure of the Kionix KMX62, KMX63 sensors. TN005 Power-On Procedure 1. Introduction This technical note is intended to provide information about the proper power-on procedure of the Kionix KMX62, KMX63 sensors. Proper functioning of power-on reset

More information

Accurate Time and Interrupts

Accurate Time and Interrupts Accurate Time and Interrupts Matthew Beckler beck0778@umn.edu EE2361 Lab Section 007 March 7, 2006 Abstract In this lab, we create a very accurate digital clock using one of the microcontroller s timers.

More information

Human Response Timer

Human Response Timer Human Response Timer Matthew Beckler beck0778@umn.edu EE2361 Lab Section 007 March 29, 2006 Abstract In this lab, we create a very useful application, a human response timer. The user s reaction time is

More information

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE;

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE; /*********************************************************************************************/ /* BME 361 Biomeasurement Lab - PIC18F4525BT Demo */ /* Laboratories 1-8: A/D, D/A, LCD display, ECG simulation,

More information

Arithmetic and Logic Instructions. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Arithmetic and Logic Instructions. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan Arithmetic and Logic Instructions Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.tw Find the sum of the values from 40H to 43H. Put the sum in filereg locations

More information

Functional block diagram AD53x1 (Analog Devices)

Functional block diagram AD53x1 (Analog Devices) Objectives - To read the A/D converter and turn the converted digital value back into an analogue voltage using an external D/A converter. The entire cycle including ADC and DAC is to be run at a fixed

More information

Chapter 13. PIC Family Microcontroller

Chapter 13. PIC Family Microcontroller Chapter 13 PIC Family Microcontroller Lesson 06 Special Function Registers for Control and status registers for the peripherals, input/output and Interrupt SFRs SFRs at the addresses of internal RAM/register

More information

Simon. Final Project Report December 11, 2009 E155. Julia Karl and Kirsten McAfee

Simon. Final Project Report December 11, 2009 E155. Julia Karl and Kirsten McAfee Simon FinalProjectReport December11,2009 E155 JuliaKarlandKirstenMcAfee Abstract: SimonisagameforchildristributedbyMiltonBradley.Toplaythegame Simon,theplayerwatchesthebuttonslightupandthenrepeatsthesamepattern

More information

Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table

Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table Group 13 April 29 th, 2008 Faculty Advisor: Professor Haibo He Group Members: William McGuire

More information

Chapter 11: Interrupt On Change

Chapter 11: Interrupt On Change Chapter 11: Interrupt On Change The last two chapters included examples that used the external interrupt on Port C, pin 1 to determine when a button had been pressed. This approach works very well on most

More information

CREATING FIRST PROJECT in mikropascal PRO for PIC32

CREATING FIRST PROJECT in mikropascal PRO for PIC32 CREATING FIRST PROJECT in mikropascal PRO for PIC32 Project mikropascal PRO for PIC32 organizes applications into projects consisting of a single project file (file with the.mpp32 extension) and one or

More information

AN 038. Getting Started with the KXTJ2. Introduction

AN 038. Getting Started with the KXTJ2. Introduction Getting Started with the KXTJ2 Introduction This application note will help developers quickly implement proof-of-concept designs using the KXTJ2 tri-axis accelerometer. Please refer to the KXTJ2 data

More information

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features: PIC16F7X 2/40-pin -Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: PIC16F7 PIC16F74 PIC16F76 PIC16F77 Microcontroller Core Features: High-performance RISC CPU Only 5 single word instructions

More information

ADC to I 2 C. Data Sheet. 10 Channel Analog to Digital Converter. with output via I 2 C

ADC to I 2 C. Data Sheet. 10 Channel Analog to Digital Converter. with output via I 2 C Data Sheet 10 Channel Analog to Digital Converter with output via I 2 C Introduction Many microcontroller projects involve the use of sensors like Accelerometers, Gyroscopes, Temperature, Compass, Barometric,

More information

Page 1 of 7. Samtron/Samsung 20S204DA2

Page 1 of 7. Samtron/Samsung 20S204DA2 Page 1 of 7 Samtron/Samsung 20S204DA2 Disclaimer This documentation based on try & error and should never be treated as official documentation. There is no guarantee that information listed in this document

More information

Protocol of SOJI Fuel level sensor FJ-RS232/FJ-RS485 Version 1.0.2

Protocol of SOJI Fuel level sensor FJ-RS232/FJ-RS485 Version 1.0.2 Protocol of SOJI Fuel level sensor FJRS232/FJRS485 Version 1.0.2 Document preparion Full Name Title Prepared by Nguyen Duy Tan Engineer Approved by Quang Nguyen Project manager Date 1 October 2016 1 October

More information

WEATHER STATION WITH SERIAL COMMUNICATION

WEATHER STATION WITH SERIAL COMMUNICATION WEATHER STATION WITH SERIAL COMMUNICATION Written by: Wenbo Ye, Xiao Qu, Carl-Wilhelm Igelström FACULTY OF ENGINEERING, LTH Digital and Analogue Projects EITF11 Contents Introduction... 2 Requirements...

More information

SH69P25/P23/P20B EVB. Application Note for SH69P25/P23/P20B EVB SH69P25/P23/P20B EVB SH69V25

SH69P25/P23/P20B EVB. Application Note for SH69P25/P23/P20B EVB SH69P25/P23/P20B EVB SH69V25 SH69P25/P23/P20B EVB Application Note for SH69P25/P23/P20B EVB The SH69P25/P23/P20B EVB is used to evaluate the SH69P25/P23/P20B chip's function for the development of application program It contains of

More information

Venstar Thermostat Adapter

Venstar Thermostat Adapter Developer Venstar Thermostat Adapter v001 Developer Venstar Thermostat Adapter Version 001 May 23, 2013 Revision History Rev Date Comments 001 05/23/13 Initial Release Page 1 of 13 Table of Contents 1

More information

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE;

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE; /*********************************************************************************************/ /* BME 361 Biomeasurement Lab - PIC18F4525BT Demo */ /* Laboratories 1-8: A/D, D/A, LCD display, ECG simulation,

More information

Developer Notes INSTEON Thermostat v012. Developer Notes. INSTEON Thermostat. Revision History

Developer Notes INSTEON Thermostat v012. Developer Notes. INSTEON Thermostat. Revision History Developer INSTEON Thermostat v012 Developer INSTEON Thermostat Version 012 June 19, 2012 Revision History Rev Date Comments 001 10/28/11 Initial Release 002 11/4/11 Updated formatting in some sections

More information

Lecture (04) PIC16F84A (3)

Lecture (04) PIC16F84A (3) Lecture (04) PIC16F84A (3) By: Dr. Ahmed ElShafee ١ Central Processing Unit Central processing unit (CPU) is the brain of a microcontroller responsible for finding and fetching the right instruction which

More information

Solutions - Homework 2 (Due date: October 4 5:30 pm) Presentation and clarity are very important! Show your procedure!

Solutions - Homework 2 (Due date: October 4 5:30 pm) Presentation and clarity are very important! Show your procedure! Solutions - Homework 2 (Due date: October 4 th @ 5:30 pm) Presentation and clarity are very important! Show your procedure! PROBLEM 1 (28 PTS) a) What is the minimum number of bits required to represent:

More information

Introduction to the MC9S12 Hardware Subsystems

Introduction to the MC9S12 Hardware Subsystems Setting and clearing bits in C Using pointers in C o Program to count the number of negative numbers in an area of memory Introduction to the MC9S12 Hardware Subsystems o The MC9S12 timer subsystem Operators

More information

EECE.3170: Microprocessor Systems Design I Summer 2017

EECE.3170: Microprocessor Systems Design I Summer 2017 EECE.3170: Microprocessor Systems Design I Summer 2017 1. What is an interrupt? What is an exception? Lecture 13: Key Questions June 19, 2017 2. For what purposes are interrupts useful? 3. Describe the

More information

AFRecorder 4800R Serial Port Programming Interface Description For Software Version 9.5 (Last Revision )

AFRecorder 4800R Serial Port Programming Interface Description For Software Version 9.5 (Last Revision ) AFRecorder 4800R Serial Port Programming Interface Description For Software Version 9.5 (Last Revision 8-27-08) Changes from Version 9.2 1. The communication baud rate is raised to 9600. 2. Testing with

More information