Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC16F877 w/DS1302 & LCD -- Hi-Tech PICC

Status
Not open for further replies.

futz

Active Member
After playing with PICC and the 16F877 to try to help engkhlaif, just for fun I carried on and interfaced a DS1302 RTC chip to make a very simple clock. It's real experimental at this point. There are no buttons to set the clock. I use hard coded values in clockset.c to set it and clock.c to just use it.

View attachment clockset.c
View attachment clock.c

It has a .33F supercap as battery backup.
pic16f877_1302_002sm.jpg
Even though I've read a lot of stuff about breadboard capacitance affecting the watch crystal on the DS1302, mine works just fine stuffed into the breadboard by the chip.
pic16f877_1302_004sm.jpg
I've had much entertainment out of this one. Figuring out the 1302 was tough at first, but once you get "over the hump" it's pretty simple. :D
 
I recently did a very similar thing. This is a 18F1320 with three DS1820s and a DS1307 on a Futurelec mini board ($6.90). I was pushing Swordfish basic to see how much I could do without breaching the 256 byte limit. This little demo used 113 bytes.

Mike.
 
Last edited:
Pommie said:
I recently did a very similar thing. This is a 18F1320 with three DS1820s and a DS1307 on a Futurelec mini board ($6.90). I was pushing Swordfish basic to see how much I could do without breaching the 256 byte limit. This little demo used 113 bytes.
Another obsessively neat breadboard! :D Absolutely beautiful! :p You must custom cut all your own wires? The precut packs never have the lengths I need, so I bend em sometimes.

I'm going shopping at Futurlec real soon. I've toured thru their site a few times over the past few months. They have some nice products.

I forget exactly how much memory mine uses, but it's at least triple that. I'm sure it could be tightened up considerably though.
 
Last edited:
I find that neat = reliable. I do custom cut the wires but it is not as arduous as people imagine. The above board took just over an hour to wire and I'll probably rip out the 1820s and 1307 and wire something else in in a matter of minutes.

I also find the same in coding. Well chosen variable names can/will reduce bugs. Rigorous indenting is an absolute must. Neatness just makes everything easier.

All I have to do know is apply my breadboard/coding philosophy to my desk and the rest of my life.:D

Mike.
 
blueroomelectronics said:
I've been reading through some well formatted and some sloppy C code, what a difference. Just trying to spot {} in some code...
I was helping a friend with some of his code online one time. It was a mess, and he couldn't figure out his problem - was totally confused. I formatted it with proper indentation and added some whitespace to organize things a bit - did nothing else but that - and sent it back to him. He almost immediately understood what he had done wrong and fixed it. His code gets properly indented now.

Wanna be forced to learn proper indentation? Program in Python. Wonderful language! Indentation is part of the syntax. It won't work without it.
 
blueroomelectronics said:
Just trying to spot {} in some code...

Now, there's a can of worms.

I prefer,
Code:
    if(x==23){
        DoSomert;
        DoSomertElse;
    }else{
        OtherStuff;
        MoreStuff;
    }

Or,

    If(x==23)
        Somert;
    else
        SomertElse;

But Not
    If(x==23)
    {
        Somert;
    }
    else
    {
        SomertElse;
    }

I just hate vertical whitespace.

I'm sure I'm going to get abused.:rolleyes:

Mike.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top