Newbie - 16F628A and switch latching - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 41 to 46 of 46
  1. #41
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    At least, your config fuses are not declare the right way. See the following thread
    http://www.picbasic.co.uk/forum/showthread.php?t=543


    NOW, are you saying that if you change them manually in your device programmer software it doesn't work?

    You declare to use an external RC oscillator... are the value of R and C meet the datasheet suggestion? Personnally, i would prefer to use the internal one

    Code:
    '  PIC config fuse using MPASM to compile
    	@ __CONFIG  _INTRC_OSC_NOCLKOUT & _MCLRE_ON  &  _LVP_OFF & _WDT_OFF & _PWRTE_ON  & _BODEN_ON
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #42
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve,

    I've tried most of the suggestions to include the config settings within the code. The only enties that doesn't halt the compiling process are

    Code:
    @INTRC_OSC_NOCLKOUT 
    @WDT_ON
    @PWRT_ON
    @MCLR_OFF
    @BOD_ON
    @LVP_OFF
    @CPD_OFF
    @PROTECT_OFF
    However these must me ignored by the compiler as the resulting LST file after the code has compiled shows a config setting of

    Code:
    __config _XT_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
    So when I come squirt the HEX file to the PIC via WinPIC pro I manually change the device config settings to RC no clockout, and have tried enabling / disabling WDT and MCLR input as well but it has no affect, the PIC seems to freeze after 60-90 seconds of running the code posted above.

    Just to prove it isn't the PIC that's faulty, I programmed a simple "Flash LEDs" using JAL and that's been running for the past hour - so the issue must be somthing with either the PBP code, the communications between PBP and MPSAM or the way MPSAM compiles the files from PBP or the manual settings in WinPIC are being overlooked when the HEX is loaded.. but then why would the code run at all if that was the case ??

    On the hardware front, as I'm using the internal OSC (or trying to) I have no Resistors or capacitors, or external crystal. The four reed switches are connected between ground and the first four pins of PORTB, with 10K pull-ups to +5v. The only other components are 8 LEDs and their 8 resistors.

    Cheers

    Malcolm

  3. #43
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Further Update...

    If I keep triggering the LEDs on PORT A (via RB0 and RB1) the PIC runs fine for ages.. I can sit there triggering the reed switches until my hearts content. However if I then trigger RB2 or RB3 and thus the LEDs on RB5,6,7,&8 then it freezes...

    I'll try making the last 4 pins of PORTA the inputs and PORTB all output and see what happens

    Update:

    Well making PORTB all outputs and A0,A1, A6 and A7 inputs (rest port A out) is worse. Now on power up all leds light up in random sequence and the extinguish and it freezes.... I'm going to try a trusty old 12F675 with just 2 inputs and see if that works - I have stack of those PICs so using 1 per pair of sidings is no real hard ship !
    Last edited by malc-c; - 18th May 2006 at 20:57.

  4. #44
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Last update

    Well, thinking that it might be the hardware, I stripped the breadboard and started from scratch making sure there was nothing left floating, or tied down to the wrong supply. Loaded the code and tested. The first two inputs (RB0 and RB1) and thier coresponding LEDs (RA1, RA0 and RA7, RA6) can be triggered until the cows come home. However triggering the any of input three or four (RB2, or RB3) causes the thing to freeze.

    I'm off to try it with the 12F675's and see if that works.

  5. #45
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default Poblem sorted

    It turns out the problem is human error... I used the wrong varable in one of the couter checks... that will teach me to cut and paste and not pay attention ! (I blame it on the wife, kids, cat for interrupting me and thus causing me to overlook the error !)

    Thanks for everyones input...

    Malcolm

  6. #46
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Well don't worry dude, it happen to everybody... you can't imagine how many keyboard and laptop i must change in a year because i destroyed them by frustration after hours/days/week of hard programming/debugging session.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  2. Addressing with Dip Switch or ???
    By tazntex in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 16th September 2008, 12:19
  3. 16f628a wont wake up
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 25th August 2008, 14:22
  4. SLEEP mode 16F628A
    By Michael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th April 2006, 17:26
  5. 16F628A using PORTA.4, and it works, but...
    By zx81 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th August 2005, 08:45

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts