EEPROM and Binary Counter

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

EEPROM and Binary Counter

Post by bitfogav » Mon May 31, 2010 7:23 am

Hey all,

I made this project a few months ago and thought It would be a good idea to share it with everyone, the project involves using the on board eeprom on the microchip and is also a 8bit binary counter using 8 LEDs..

I made it so a I could learn more about programming eeprom, and learn more about addressing eeprom memory and learn about reading and writing to and from the eeprom with microchips, it will probably make a good tutorial in Brads University? hehe!

Heres a picture of the project on breadboard


Image


How is works, well you have one button connected as a input, the microchip then counts how many times you press the button, at the same time a selected led is turned on, but the leds are arranged in a 8bit binary form, what I mean by this is that, if you pressed the button 10times this indicates 10, So the led to the far right would be on and the 4th from the right, this would indicate a binary count of 8 and 2 which = 10

If someone knows how 8bit binary works then they would understand this abit more but this could be a good project to help someone understand 8bit binary..

So has for the EEPROM side of it, when you release the counting button the microchip will save the number of counts into the eeprom and then if the power was turned off from the microchip, the next time the power was applied to the microchip the value would be read from the eeprom and displayed again on the leds..

I have also added another switch to the microchip which resets the counts and the stored eeprom counter value..

Heres the souce code

http://www.bradsprojects.com/phpBB2/upl ... v1_174.asm

I will make some schematics aswell and post them soon
Attachments
binary_counter.jpg
binary_counter.jpg (45.59 KiB) Viewed 13309 times
Binary counter.jpg
Binary counter.jpg (45.1 KiB) Viewed 13341 times
Binary Counting TutorialV1.asm
(8.82 KiB) Downloaded 498 times

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Post by bitfogav » Mon May 31, 2010 7:58 am

Heres the schematics :)

http://www.bradsprojects.com/phpBB2/upl ... er_170.zip

Note this schematics is for EAGLE
Attachments
Eeprom & Binary Counter.zip
(13.71 KiB) Downloaded 554 times

User avatar
sdudley
Moderator
Moderator
Posts: 337
Joined: Sun Mar 28, 2010 1:33 pm
Location: Florida, U.S.A.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by sdudley » Mon May 31, 2010 8:58 am

What a great project!

I love projects that are quick, to the point, and do something useful. Definitely should become a tutorial!

I did not read through the code but had a quick look and love how nice and clean it is (makes for easy reading). I like to section off my routines just like you did.

I have always wanted to look into programming with eeprom storage. This is my chance!

Thank you.

:D

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Post by bitfogav » Mon May 31, 2010 9:07 am

Thanks Stacy :)

The souce code that I have uploaded is a basic start to eeprom and the way it works, you can change the souce code to select different eeprom addresses to store your data, and read your eeprom from your programmer, if you got a pickit2 this is quite easy.

I guess I should make a tutorial for it because before I started looking into eeprom on the microchip I didnt know where to start, took me awhile reading through the datasheet to understand it :)

User avatar
sdudley
Moderator
Moderator
Posts: 337
Joined: Sun Mar 28, 2010 1:33 pm
Location: Florida, U.S.A.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by sdudley » Mon May 31, 2010 9:25 am

bitfogav wrote:...before I started looking into eeprom on the microchip I didnt know where to start, took me awhile reading through the datasheet to understand it :)
I know exactly how you feel. I wanted to know about interrupts and could not find any plain and simple answers. Like you, I spent a LOT of time reading through the datasheet, asking questions on the Microchip forum and searching around.

I just wanted a very basic tutorial on how an interrupt works and something so I could see it working. That is why I finally uploaded one to Brad's Projects University. I tried really hard to keep it as simple as possible.
I am excited to go through your code and see how to utilize eeprom in my projects!

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Post by bitfogav » Mon May 31, 2010 9:32 am

Yeah thats the thing, I learn more if somebody shows me but all I have is what I learnt from here or reading books or the internet.. :)

Ill be glad to help you if you ever get stuck or have a question about my souce code :)

Ill look forward to see what you come up with..

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by brad » Mon May 31, 2010 8:36 pm

Nice project :)

This is something I want to implement in my projects - perhaps to save some game data - maybe to save what level you are upto, or maybe a high score or something... hmm...

I have read through the source code and I may have some questions for you later :)

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Post by bitfogav » Mon May 31, 2010 8:39 pm

Thanks and yeah sure :)

I have found though that on bigger microchips the setup of eeprom eg, writing and reading from eeprom are slightly different.. :)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by brad » Mon May 31, 2010 8:44 pm

Its the same for data tables also.

instead of using retlw instructions, you use tblrd and it is a very different process. The upside is that there is no limit to the amount of data in your table. (only limited by the program memory space of the pic)

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Post by bitfogav » Tue Jun 08, 2010 4:19 am

For people who dont know much about eeprom then I recommend looking at this website :)

http://www.arlabs.com/help.htm

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 1 guest