TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (405 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (133 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (141228 times)
  2. FAT32 Library (74037 times)
  3. Network Ethernet Library (58659 times)
  4. USB Device Library (48766 times)
  5. Network WiFi Library (44485 times)
  6. FT800 Library (44034 times)
  7. GSM click (30784 times)
  8. mikroSDK (29601 times)
  9. PID Library (27342 times)
  10. microSD click (27188 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Example

Log ADC Values when button is pressed in internal EEPROM

Rating:

0

Author: Petar Timotijević

Last Updated: 2013-07-02

Package Version: 1.0.0.0

Example: 1.0.0.0

Category: Measurement

Downloaded: 1578 times

Not followed.

License: MIT license  

Log ADC Values when button is pressed in internal EEPROM

RD0 - Start Log

RD1 - Erase complete EEPROM


LCD shows current ADC steps and voltage in 0-5V range.
Each time when RD0 is pressed uC take 8 samples from ADC in intervals of 3sec and stop.
PortC LEDs shows progress of sampling each byte in EEPROM like bargraph.



No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Log ADC Values when button is pressed in internal EEPROM" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Log ADC Values when button is pressed in internal EEPROM" changes.

Do you want to report abuse regarding "Log ADC Values when button is pressed in internal EEPROM".

  • Information
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

Example Blog

Log ADC Values when button is pressed in internal EEPROM

Development board system : EasyPIC7
Compiler : MikroC Pro for PIC 6.0.0
Microcontroller : PIC18F45K22 32MHz (can be any other similar)

PORT A - RA1 10-bit ADC Input
PORT B - LCD 2x16
PORT C - 8 LEDs
PORT D - RD0 Start Log, RD1 Erase all data in EEPROM

Each time when RD0 is pressed PIC get 8 samples from ADC in 3sec intervals and stops.




PIC18F45K22 EEPROM space

PIC18F45K22 EEPROM space

Current screenshot shows empty EEPROM. Last address in EEPROM holds address of next free memory slot for log. Currently on screenshot whole memory is empty. Some other uC such as PIC18F46K22 have 1024 bytes EEPROM.

View full image
LCD Screen with 255 ADC steps

LCD Screen with 255 ADC steps

LCD Screen with 255 ADC steps

View full image
LCD Screen with 893 ADC steps

LCD Screen with 893 ADC steps

LCD Screen with 893 ADC steps

View full image
EEPROM filled with datas

EEPROM filled with datas

Some logged samples in EEPROM. At 0xFF (last) address you can see value 40 (0x40). This means next free address for writing is 0x40. Current screenshot shows that we pressed 4 times RD0 button and we log 32 ADC steps values (each row 8 samples (16 bytes).

View full image
EEPROM is full

EEPROM is full

There is no free space for new datas. PortC LEDs blinks several times and on LCD 'MemFull' note.

View full image
EEPROM is full

EEPROM is full

There is no free space for new datas. PortC LEDs blinks several times and on LCD 'MemFull' note. Value 0xFE on 0xFF address tells that memory is full. Address 0xFE can be used together with 0xFF to support larger EEPROM size.

View full image
Examples of writing/reading data in EEPROM

Examples of writing/reading data in EEPROM

Examples of writing/reading data in EEPROM Two bytes are used for each sample. Examples: DEC 255 BIN 11111111 HEX FF (one byte) DEC 1023 BIN 11 11111111 HEX 03 FF (two bytes) DEC 512 BIN 10 00000000 HEX 02 00 (two bytes)

View full image

ALSO FROM THIS AUTHOR

ADC Code Examples for Various Offset Ranges

5

ADC Input: 0-5V Output 2x16 LCD: 0-5V ADC Input: 0-5V Output 2x16 LCD: 0-20V ADC Input: 0-5V Output 2x16 LCD: -25A 0 +25A ADC Input: -10V 0 +10V Output 2x16 LCD: 0-5V ADC Input: -2,5V 0 +2,5V Output 2x16 LCD: -2,5V 0 +2,5V ADC Input: -20V 0 +20V Output 2x16 LCD: 0-5V ADC Input: -5V 0 +5V Output 2x16 LCD: 0-5V

[Learn More]

Alarm System 12V Lead Acid Battery Charger (Simple Example Version)

0

Device purpose is to maintain alarm system 12V battery on float charge voltage. When battery voltage reach or go above 13,80V charger is disconnected. In : ADC 0-5V Out : LCD 0-18V RA1 is ADC input. RC0 is output to control charger. RC0 On &lt;= 13,80V &gt; RC0 Off

[Learn More]

Police Lights

0

Police Lights for EasyPIC7 PORTC (7,6,5 and 2,1,0) All LEDs are red, replace 3 red LEDs with blue type in real project.

[Learn More]