TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 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 (136822 times)
  2. FAT32 Library (69984 times)
  3. Network Ethernet Library (55971 times)
  4. USB Device Library (46283 times)
  5. Network WiFi Library (41894 times)
  6. FT800 Library (41203 times)
  7. GSM click (28999 times)
  8. PID Library (26421 times)
  9. mikroSDK (26386 times)
  10. microSD click (25383 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: 1535 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

Knight Rider

5

Knight Rider 1.0 for EasyPIC7 8 LEDs on PORTC

[Learn More]

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]

Multiple Screens on LCD 2x16

0

LCD 2x16 Multiple Screens EasyPIC7 Development System Board PIC18F45K22 32MHz (4xPLL) or any other Enable LCD Backlight on DIP SW4 switch 6. Enable PortC on DIP SW3 switch 3. Set pull-down for RC0,RC1. Use RC0 to go left. Use RC1 to go right. In while loops add your instructions. Best regards, Peter

[Learn More]