chuong 10 mạch đo tốc độ động cơ và giá cước taxi

5 111 0
chuong 10 mạch đo tốc độ động cơ và giá cước taxi

Đang tải... (xem toàn văn)

Thông tin tài liệu

Chương 10:Phụ Lục Code CCS su dung EEPROM chip #include #fuses HS,NOWDT,NOPROTECT,NOLVP #use delay(clock=20000000) #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) #include "stdlib.h" #include #include "limits.h" // The following initializes the first locations of the data EERPOM // using the #ROM directive #rom 0x2100={1,2,3,4} typedef int8 INTEE; void main() { unsigned int8 i, j, address; INTEE value; { printf("\r\n\nEEPROM:\r\n"); // Display contents of the first 64 for(i=0; i 8); lower_addr=(int)(address & 0x00FF); i2c_start(); i2c_write(0xa0); i2c_write(upper_addr); i2c_write(lower_addr); i2c_write(data); i2c_stop(); delay_ms(11); //******************************************************** unsigned char read_eeprom(long int address) { unsigned char data; int upper_addr; int lower_addr; upper_addr=(int)(address >> 8); lower_addr=(int)(address & 0x00FF); i2c_start(); i2c_write(0xa0); i2c_write(upper_addr); i2c_write(lower_addr); i2c_start(); i2c_write(0xa1); data=i2c_read(0); i2c_stop(); return(data); } // ax25 main() void testrom() { int16 i; unsigned char x; char DIGITS[15] ={"Tran Minh Duc"}; if(RCIF) { x=getch(); portb=x; if(x=='b') { putch('c'); output_low(PIN_B4); output_high(PIN_B5); for(i=0;i

Ngày đăng: 07/09/2017, 15:28

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan