1. 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.
    Dismiss Notice

16F877A John Becker home Alarm.

Discussion in 'Microcontrollers' started by spr001, Sep 22, 2012.

  1. spr001

    spr001 New Member

    Joined:
    Sep 22, 2012
    Messages:
    5
    Likes:
    0
    Location:
    Whitchurch Shropshire UK
    Hi All
    I am totally new to all this so please give me a chance. In the past the most complicated thing I have had to deal with was Dolby Cinema sound processors and old valve cinema amps so PIC and programming is all new.

    As I am now disabled I needed to find new hobby's and reinvent old ones so 6 months ago I started with electronics and PIC's. Having used the 16F877A for my midi organ I looked for an alarm using the same pic as I still had 5 left. when I found the John Becker one it was perfect. I know that this has been talk about back in 2008 but none of that has helped me so far. I built it up on the bread board, downloaded the program but no matter what I do I can not get it to work. I am using PikLab, picprog2009, the Velleman 8048. I have downloaded 3 asm file and the Hex file from EPE. I programmed the Hex file then read the pic and the Hex file from the pic is identical to the original. I have replaced the pic and the LCD but all I get is a blank LCD. I have tried other programs to check the pic and LCD and they worked fine.
    I have added transistors and led's to the programmer board to monitor the data, clock and reset to the pic and it all looks fine.
    I have one concerns, one, the crystal I am using is a 4Mhz and not the 3.286 as in the diagram.
    Could this be the crystal or am I doing something totally stupid?
    This alarm is perfect for my needs as I have 2 sheds and a workshop plus it has the panic button for when I fall.
    Any help would be very much appreciated.
    Steve :(
     
  2. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    It is hard to give you any help with the information provided and what you are attempting.
    First go over your circuit wire by wire to make sure you have it right.
    Have you verified that the PIC has been programmed?

    If that does not help post the schematic or a link to it. We can write you a little test program to blink an LED or such.

    I have two suggestions for the future.

    The first is to get a pickit3 from microchip for $45.

    The second it to learn to program. You will get far more out of this hobby by doing so. There are a lot of details but nothing that is all that hard about it.
     
  3. House0Fwax

    House0Fwax Member

    Joined:
    Nov 15, 2006
    Messages:
    583
    Likes:
    17
    Location:
    Hampshire U.K.
    Quite possibly the crystal is causing the problem, in the article he states;

    "The PIC is operated at 3ยท2768MHz, as
    set by crystal X1. It is this rate which determines
    the accuracy of the software clock
    that controls the bell-on duration and
    entry/exit timing. In order to comply with
    the allocated timings, a different frequency
    must not be used with this design."
     
    Last edited: Sep 22, 2012
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA

    House0Fwax with a 4MHz crystal it should still come to life.
     
    Last edited: Sep 22, 2012
  6. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,170
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    Have you a ink to the hex file.... I'll check the config settings.... John, although a great programmer, used his own assembler... He could cut corners....
     
  7. spr001

    spr001 New Member

    Joined:
    Sep 22, 2012
    Messages:
    5
    Likes:
    0
    Location:
    Whitchurch Shropshire UK
    Thank you all for you reply. How is Rochdale? I have not been there since 1974 when I worked at the Odeon.

    This is the link to the EPE download for the Hex file. It is in Home > library > project codes > 2002 > April. http://www.epemag3.com/index.php?option=com_docman&task=doc_download&gid=131&Itemid=38.

    I did discover that John used his own code when I fist tried it as it just would not compile and I then noticed all the odd $ every where.. I then found an asm file which said it was a mod for MPLAB. This will compile but, I get this in the compile log :-
    gpasm -c -I/home/spr/Pic Alarm/ -pp16f877a -w0 New Alarm.asm
    New Alarm.asm:3: warning: Processor superseded by command line.
    New Alarm.asm:17: error: Value of symbol "OPTION_REG" differs on second pass
    pass 1=129, pass 2=1
    New Alarm.asm:41: error: Value of symbol "EECON2" differs on second pass
    pass 1=397, pass 2=13
    *** Exited with status: 1 ***

    I have been looking for the link to the site I downloaded it from but can not find it and I am not sure if I can attach or paste it to a reply here. Here is the schematic View attachment 67425

    I am certain that the pic is programmed as I can read it back from the pic. As I said in the first post I compared the 2 and there was no difference.
    I have programmed the same pic in my programmer with other programs and they all work fine.
    I am learning to program and am doing ok. The midi program I have used for my organ was written to scan 127 keys, I only needed 61 so I set about changing that. It took me two days as I have to stop every so often because of my pains but I did it and that is what lead on to this.
     
  8. House0Fwax

    House0Fwax Member

    Joined:
    Nov 15, 2006
    Messages:
    583
    Likes:
    17
    Location:
    Hampshire U.K.
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,190
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi spr001
    I have converted the alarm415.asm to alarm415c.asm that can be assembled with MPLAB or Oshonsoft.

    It appears to run OK, the rest is up to you.:rolleyes:

    E.
     
    • Like Like x 1
  10. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,235
    Likes:
    641
    Location:
    Derbyshire, UK
    I spoke to John many years back, it was a bit bizarre, he'd never even heard of MPASM?, and was using a shareware assembler configured for MicroChip PIC's, rather than the completely free (and superior) MPASM.
     
  11. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    The schematic is missing 0.1uF and other bypass and or filter caps. It'll be a mess without them.
     
  12. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,190
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi Bill,
    I also noticed that, also that the 100K/47K resistor ratio on the zone alarm signal input pins.

    E.
     
  13. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,235
    Likes:
    641
    Location:
    Derbyshire, UK
    It's got C6 across the supply (0.1uF) fairly close to the chip - it's a well tried and tested design, and (as far as I'm aware) a decent number of kits have been sold for it.
     
  14. spr001

    spr001 New Member

    Joined:
    Sep 22, 2012
    Messages:
    5
    Likes:
    0
    Location:
    Whitchurch Shropshire UK
    I was not to sure about the 0.1uF's and the resistor network but, working on some of the early Dolby cinema sound processors nothing surprises me any more including an amp that hummed like hell unless you used coax cable.
    I will give the program a shot later thank you.
    Steve
     
  15. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    Standard practice is to 0.1uf to decouple digital ICs very near every ICs power pins. I recall that project. I think it originally used the Tech-Tools assembler (which I liked at the time).
     
  16. spr001

    spr001 New Member

    Joined:
    Sep 22, 2012
    Messages:
    5
    Likes:
    0
    Location:
    Whitchurch Shropshire UK
    After a bit of fun with R2 which is on RW of the LCD and should read 10K but read 4M on the Fluke meter I got Eric's asm file up and running. I have a bug on the buzzer, when you set the alarm. When the exit count down ends instead of going silent the buzzer changes tone. It will only stop if I press an other key on the key pad. The same thing happened on entry, when you have keyed in the code the buzzer will not stop nor will the LCD change to show "ALARM OFF" until I press the # key.
    This can not be much. a good look at the code should reveal the problem unless this did not happen when Eric tried it, but the exercise will do me good.

    I have added capacitor to the supply rails by the side of the PIC. I have also added resistors to the bell, strobe, panic and the free out put. With the zone inputs resistor networks as they are they work well.
    I have had it on test for 24 hours and it works fine. once I have the bug sorted out I will install it.
    Steve
     
  17. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,190
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi spr,
    Scan thru the asm file I posted.
    Where I made changes to the code I didn't delete the 'old' parts I just remme'd them out.

    The original code did not use a prefix for 'decimal' values, so used the '.' prefix eg: movlw 15 I changed to movlw .15
    The b'00000000 binary and $ EQU's values I changed to hex , eg b'00001111 changed to 0x0F

    E

    EDIT:
    Have rechecked the conversion, cannot see see any errors.
     
    Last edited: Sep 27, 2012
  18. spr001

    spr001 New Member

    Joined:
    Sep 22, 2012
    Messages:
    5
    Likes:
    0
    Location:
    Whitchurch Shropshire UK
    Hi E
    I have just finished the making the board for the alarm and as I have the breadboard connected up to the workshop I programmed an other PIC and that one works fine so it must have been in the programming of the test pic.

    I did look at the code and noticed how you had modified it. It must have taken sometime to do.
    Now I have a good basics system working I will use the breadboard to play about with as I need to learn more and my wife asked if I could make remote control entry so she only has to press a button on a key fob to disarm the alarm when she has her hands full of shopping. I would like it to call me if the alarm goes off when I am away from home.

    Once again thank you for your help.

    Steve
     
  19. kushan

    kushan New Member

    Joined:
    Jun 1, 2017
    Messages:
    3
    Likes:
    0
    I'm a hobbyist, i like this project very much,but i have a problem to make hardware part. sir cant find 3.2768 MHz crystal in my region.can modified codes(whitch part of asm file) for 4/8/10/Mhz crystal?pls i like and want to make this help me to solve this problem...can u send me a all codes files..i want and still learning pic programming.(still 0 but i try)
     
    • Dislike Dislike x 1
  20. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,170
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    With a 4Mhz crystal instead of the 3.2Mhz the delay will be 0.2s shorter... so a 20 second delay will be 16 seconds..

    If you don't need the accuracy... Just use a 4Mhz..
     
  21. kushan

    kushan New Member

    Joined:
    Jun 1, 2017
    Messages:
    3
    Likes:
    0
    no,i think large time difference in 24 hrs. any option for this, mean change codes !
     

Share This Page