Include "modedefs.bas"
@ Device PIC16F877,XT_OSC,WDT_off,PWRT_off,PROTECT_off ,BOD_Off
define adc_bits 10
define osc 4
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 1
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 0
low portD.2
S1 var PORTA.0
sda var portc.4
scl var portc.3
addr var byte
cont con %10100000
dat con 45
b0 var byte
TRISA = %111111
adcon1 = 7
addr = 2
'---------------- main program -----------------
lcdout $fe,1,"EEPROM 24LC16B"
PAUSE 2000
start:
if S1= 1 then
pause 100
lcdout $fe,1,"WRITE DATA =45"
i2cwrite sda,scl,cont,addr,[dat]
pause 1000
ENDIF
if (s1 = 0) then
pause 100
i2cread sda,scl,cont,addr,[b0]
pause 1000
lcdout $fe,1,"READ DATA= ",$fe,$8B,dec b0
ENDIF
goto stART
END
Related projects
PIC16F877 Driving LCD in 4-Bit Mode using PIC16F877 with Proteus Simulation
Introduction This microcontroller project shows how a PIC16F877 can drive an LCD display using 4-bit mode inside a Proteus simulation.The project demonstrates...
Programmers & ICSP · PIC16F877AEPE PIC/LCD Demo using PIC16F877 with Proteus Simulation
IntroductionThe EPE PIC/LCD Demo is a classic microcontroller project that demonstrates how a PIC16F877 can fully control a PG12864F graphical LCD.Designed as...
Motors & Robotics · PIC16F877AEfficient Sun-Following Robot: A Solar Tracker with Microcontroller Control
Abstract The impending global challenge of dwindling non-renewable fuel resources underscores the urgency of transitioning towards renewable energy alternatives like solar power....
Peripheral Tutorials · PIC18F4550PICDEM FS USB Mass Storage Device using PIC18F4550 with Proteus Simulation
Introduction This microcontroller project demonstrates how to simulate a USB Mass Storage Device (MSD) using the PIC18F4550 in a Proteus simulation environment....
Peripheral TutorialsHands-On Digital I/O Lab with PIC18F46K22 Microcontroller
PIC18F46K22 Microcontroller Digital I/O specifically explores the design of simple combinational circuits using the digital I/O capabilities of the PIC18F46K22 microcontroller. Moving...
Peripheral TutorialsDesign for manufacturing and assembly: DFA&DFM
Product developers understand the challenges involved in creating a market-ready product. Even experienced designers often go through multiple prototype iterations before reaching...